You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3 sounds safer than 2, but there is still a cost of maintenance to reflect changes in ruby files(and there is a possibility ruby will change Bignum internal implementation)
There is also a feature request in Ruby to add popcount method to Integer, which would speed up pure Ruby solution if accepted.
I made an example version of public Ruby API approach in a PR, which slower than BDIGIT approach, but still much faster than pure Ruby
user system total real
distance3_bdigit 0.198673 0.000000 0.198673 (0.198672)
distance3_public 0.373779 0.000000 0.373779 (0.373777)
distance3_ruby 1.824285 0.000000 1.824285 (1.824315)
Hello, I saw a bug https://bugs.ruby-lang.org/issues/17174 you posted a some while ago and tried to find out what is happening.
Looks like it was because you've used internal BDIGIT api, which was removed after Bignum and Fixnum were merged into Integer in ruby 2.4(https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/), after which Bignum implementation was hidden(ruby/ruby@841bf2b)
But ruby-slim was packed with additional headers for some time:
Though it's not the case now(e.g. in ruby 3.3.3)
So to fix the compilation there are the ways:
3 sounds safer than 2, but there is still a cost of maintenance to reflect changes in ruby files(and there is a possibility ruby will change Bignum internal implementation)
There is also a feature request in Ruby to add
popcount
method to Integer, which would speed up pure Ruby solution if accepted.I made an example version of public Ruby API approach in a PR, which slower than BDIGIT approach, but still much faster than pure Ruby
I've tried several other approaches e.g. with making only popcount in C, and this is the fastest without much trouble with compilations.
You can see the benchmark here https://github.com/haukot/dhash-vips/blob/compare_methods/idhash.c#L11
The text was updated successfully, but these errors were encountered: