Skip to content

Rewrite C ext to public C api #20

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

Merged
merged 1 commit into from
Apr 12, 2025
Merged

Rewrite C ext to public C api #20

merged 1 commit into from
Apr 12, 2025

Conversation

haukot
Copy link
Contributor

@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)
@Nakilon Nakilon merged commit 8430ad9 into Nakilon:master Apr 12, 2025
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.

2 participants