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

XS for Int is faster inline #145

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

Conversation

zmughal
Copy link

@zmughal zmughal commented Aug 27, 2023

As discussed on Mastodon,
this was determined using the following script:

#!/usr/bin/env perl

use Benchmark qw(cmpthese);
use Type::Tiny::XS;

print "$^V\n";
cmpthese(50_000_000, {
	regex => sub { my $my_val = '1000000'; die unless do { my $tmp = $my_val; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }  },
	xs    => sub { my $my_val = '1000000'; die unless Type::Tiny::XS::Int($my_val)  },
});
__END__
v5.38.0
            Rate regex    xs
regex  3351206/s    --  -76%
xs    14044944/s  319%    --

@zmughal zmughal marked this pull request as ready for review August 28, 2023 02:48
@zmughal
Copy link
Author

zmughal commented Oct 5, 2023

Hello @tobyink, bumping this PR in case you have a tuit.

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.

None yet

1 participant