-
-
Notifications
You must be signed in to change notification settings - Fork 924
float equality problem #5243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ok, it's just a side-effect of an optimalization that MRI uses since ruby 2.0 https://bugs.ruby-lang.org/issues/6763 jruby just works like ruby 1.9.x do you think it's worth to implement it in jruby?
jruby-head |
We will not (can not) implement this because there's no way to mix pointers (references) and primitive types on the JVM. The fact that Fixnum-ranged Integers and Floats are now immediate values (tagged pointers) on CRuby is an implementation side-effect you should not rely on. |
Also, I'm not sure what benchmark you were running, but I looped ten times over your example, recording the time to complete each 30M loop, and my numbers don't look anything like yours:
JRuby should definitely be faster than MRI even without flonums. |
I retested and it's indeed faster on jruby, thanks @headius |
Environment
jruby 9.2.1.0-SNAPSHOT (2.5.0) 2018-07-07 9d52bae Java HotSpot(TM) 64-Bit Server VM 9.0.4+11 on 9.0.4+11 +jit [linux-x86_64]
it's not a regression, it behaves the same way on 9.1.15.0
Expected Behavior
Actual Behavior
it's probably because of this issue isn't implemented in jruby? https://bugs.ruby-lang.org/issues/6763
The text was updated successfully, but these errors were encountered: