Java8字符串重复数据删除和jruby

编程入门 行业动态 更新时间:2024-10-27 13:34:15
Java8字符串重复数据删除和jruby - 没有影响?(Java8 string deduplication and jruby - no effect?)

我正在尝试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).

更多推荐

本文发布于:2023-07-24 20:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1251006.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   数据   jruby

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!