[#28561] Ruby::DL vs Ruby::FFI — Aston <blackapache512-ticket@...>

Ruby.DL and FFI libraries are great for programmers like me who are not internet programmers, but are more interested in scientific and number processing etc.

11 messages 2010/03/08

[#28686] trunk (26947) build fail with msys/mingw/vista — Jon <jon.forums@...>

I get the following build failure when msysgit's "c:\git\cmd" dir is on PATH.

8 messages 2010/03/16

[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28870] Improved Delegator for 1.8?

From: Charles Oliver Nutter <headius@...>
Date: 2010-03-22 18:51:16 UTC
List: ruby-core #28870
Hello!

I've been trying to improve the perf of Delegator in JRuby (under 1.8
mode) since it's used by WeakRef and we want people to start using
WeakRef instead of id2ref.

1.9 has a new delegate.rb, but I'm not sure it behaves the same as
1.8's Delegator, specifically because it doesn't define all methods
from the object:

~/projects/jruby ➔ ruby -v -rdelegate -e "p
SimpleDelegator.new([]).methods(false)"
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
["insert", "sort", "include?", "&", "size", "to_ary", "clear",
"shuffle", "enum_cons", "replace", "inject", "zip", "pack", "detect",
"min_by", "flatten!", "to_s", "pop", "cycle", "enum_with_index", "*",
"indices", "nitems", "enum_slice", "index", "collect", "+",
"compact!", "max", "=~", "last", "rassoc", "count", "group_by",
"drop", "delete", "delete_at", "one?", "combination", "collect!",
"select", "each_index", "-", "flatten", "fill", "length", "sort_by",
"uniq!", "at", "all?", "choice", "reduce", "reject!", "[]", "take",
"inspect", "shift", "compact", "[]=", "|", "slice!", "find_index",
"max_by", "<<", "transpose", "each", "empty?", "entries", "each_cons",
"map", "rindex", "reverse_each", "member?", "uniq", "push", "to_a",
"minmax", "find", "reverse!", "first", "none?", "delete_if",
"drop_while", "product", "each_with_index", "join", "map!", "reject",
"indexes", "concat", "each_slice", "slice", "grep", "fetch", "<=>",
"min", "assoc", "partition", "permutation", "any?", "values_at",
"take_while", "==", "reverse", "find_all", "===", "unshift", "sort!",
"minmax_by", "shuffle!"]

~/projects/jruby ➔ ruby1.9 -v -rdelegate -e "p
SimpleDelegator.new([]).methods(false)"
ruby 1.9.2dev (2010-03-19 trunk 26976) [x86_64-darwin10.2.0]
[]

I first wrote a native Delegator that's much faster than the one in
delegate.rb, but it behaves more like 1.9. So I worried about
compatibility.

Shown here: http://gist.github.com/340378 is a modified version of the
1.8 Delegator that behaves (almost) exactly the same but runs many
times faster (nearly 100x for a simple benchmark below).

~/projects/jruby ➔ jruby -v -rdelegate -rbenchmark -e "5.times { puts
Benchmark.measure { 10_000.times { SimpleDelegator.new(self) }}}"
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-03-22 81672e5) (Java
HotSpot(TM) Client VM 1.6.0_17) [i386-java]
  0.265000   0.000000   0.265000 (  0.244000)
  0.091000   0.000000   0.091000 (  0.090000)
  0.077000   0.000000   0.077000 (  0.077000)
  0.079000   0.000000   0.079000 (  0.079000)
  0.075000   0.000000   0.075000 (  0.076000)

~/projects/jruby ➔ ../jruby-1.4.0/bin/jruby -v -rdelegate -rbenchmark
-e "5.times { puts Benchmark.measure { 10_000.times {
SimpleDelegator.new(self) }}}"
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java
HotSpot(TM) Client VM 1.6.0_17) [i386-java]
  6.914000   0.000000   6.914000 (  6.884000)
  6.436000   0.000000   6.436000 (  6.436000)
  6.406000   0.000000   6.406000 (  6.406000)
  6.484000   0.000000   6.484000 (  6.484000)
  6.459000   0.000000   6.459000 (  6.459000)

I am wondering if there would be interest in including this in a 1.8.7
update, so libraries using WeakRef won't be penalized compared to
running on JRuby.

- Charlie

In This Thread

Prev Next