Skip to content
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

Rewrite C ext to public C api #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

haukot
Copy link

@haukot haukot commented Jun 30, 2024

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 #21

BDIGIT api is internal ruby C api, and was removed from public api after
merge of Bignum and Fixnum into Integer.
Now use public C ruby api.

It is slower than 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant