我正在尝试java8字符串重复数据删除,遗憾的是我无法创建一个jruby程序,它可以演示如何启用java重复数据删除也有助于jruby(1.7.19)。
问题:
jruby是否利用java8字符串重复数据删除? jruby有一个特殊的选择吗?
是否有一个示例程序来显示如何使用-J-XX:+UseStringDeduplication运行jruby -J-XX:+UseStringDeduplication比没有此选项的jruby更好?
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).
Questions:
Does jruby take advantage of java8 string deduplication? Is there a special option for jruby for this?
Is there an example program to show how jruby running with -J-XX:+UseStringDeduplication is better than jruby without this option?
最满意答案
JRuby的(Ruby)String( org.jruby.RubyString实例)对象与java.lang.String不同...因此重复数据删除不会对Ruby Strings产生影响。 org.jruby.util.ByteList (Ruby String internals)的内部表示形式为byte[]而重复数据删除适用于char[]数组(Java String的内部)。
在JRuby上没有特殊的标志,它仍然可能会产生一些影响,因为String实例(虽然大多数是为Ruby方法名称实例化)在内部使用 - 如果没有尝试就很难分辨多少(但如果实际上它可能被认为很多)一个bug)。
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. 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).
there's no special flag for this on JRuby, it still might have some effect since String instances (although mostly interned e.g. 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).
更多推荐
发布评论