dhash-vips
dhash-vips copied to clipboard
Rewrite C ext to public C api
BDIGIT api is an internal ruby C api, and was removed from public api after merge of Bignum and Fixnum into Integer. Using public API's rb_integer_pack which converts a ruby integer to array of C integers(or longs).
It is slower than the previous BDIGIT api, but much faster than ruby version
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)
Tested on
ruby:2.7.2-slim
ruby:3.3.3-alpine
ruby:2.7.2-alpine
on ubuntu with ruby 3.2.2
cc https://github.com/Nakilon/dhash-vips/issues/21