-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
JRuby currently uses Java's BigInteger to handle String#to_i when it might need a Bignum. However, this algorithm is quite a bit slower than the one in MRI 2.1.
system ~/projects/jruby/jruby-tmp $ rvm ruby-head do ruby -v -rjson
-rbenchmark -e 'p Benchmark.realtime { ("1" * 1000000).to_i }'
ruby 2.1.0dev (2013-09-30) [x86_64-darwin12.5.0]
0.895446
system ~/projects/jruby/jruby-tmp $ rvm jruby-1.7.8 do ruby -v -rjson
-rbenchmark -e 'p Benchmark.realtime { ("1" * 1000000).to_i }'
jruby 1.7.8 (1.9.3p392) 2013-11-18 0ce429e on Java HotSpot(TM) 64-Bit
Server VM 1.8.0-ea-b115 +indy [darwin-x86_64]
24.387
system ~/projects/jruby/jruby-tmp $ jruby -v -rjson -rbenchmark -e 'p
Benchmark.realtime { ("1" * 1000000).to_i }'
jruby 9000.dev (2.1.0.dev) 2013-11-23 f73ef68 on Java HotSpot(TM)
64-Bit Server VM 1.8.0-ea-b115 +indy [darwin-x86_64]
24.227
I had a quick look at the algorithm and I don't think it would be hard to mimic.
Reactions are currently unavailable