简体   繁体   English

Java8字符串重复数据删除和jruby - 没有影响?

[英]Java8 string deduplication and jruby - no effect?

I'm experimenting with java8 string deduplication and sadly I'm unable to create a jruby program which can demonstrate how enabling java deduplication also helps jruby (1.7.19). 我正在尝试java8字符串重复数据删除,遗憾的是我无法创建一个jruby程序,它可以演示如何启用java重复数据删除也有助于jruby(1.7.19)。

Questions: 问题:

  • Does jruby take advantage of java8 string deduplication? jruby是否利用java8字符串重复数据删除? Is there a special option for jruby for this? jruby有一个特殊的选择吗?

  • Is there an example program to show how jruby running with -J-XX:+UseStringDeduplication is better than jruby without this option? 是否有一个示例程序来显示如何使用-J-XX:+UseStringDeduplication运行jruby -J-XX:+UseStringDeduplication比没有此选项的jruby更好?

JRuby's (Ruby) String (instances of org.jruby.RubyString ) objects are different from java.lang.String ... thus the deduplication won't have effect on your Ruby Strings. JRuby的(Ruby)String( org.jruby.RubyString实例)对象与java.lang.String不同...因此重复数据删除不会对Ruby Strings产生影响。 The internal representation of org.jruby.util.ByteList (Ruby String internals) is byte[] while the de-duplication works on char[] arrays (internals of a Java String). org.jruby.util.ByteList (Ruby String internals)的内部表示是byte[]而重复数据删除适用于char[]数组(Java String的内部)。

there's no special flag for this on JRuby, it still might have some effect since String instances (although mostly interned eg for Ruby method names) are used internally - how much it's hard to tell without trying (but if it's actually much it might be considered a bug). 在JRuby上没有特殊的标志,它仍然可能会产生一些影响,因为String实例(尽管大多数实例化为例如Ruby方法名称)在内部使用 - 如果不尝试就很难分辨多少(但如果真的很多,可能会考虑它一个bug)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM