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

Minor macro interpreter "identify". tr("c", "x") is always slower than gsubs. #4586

Conversation

akzhan
Copy link
Contributor

@akzhan akzhan commented Jun 18, 2017

  tr single char string   4.38M (228.22ns) (± 1.14%)  1.50× slower
       gsub single char    5.0M (200.19ns) (± 2.18%)  1.31× slower
gsub single char string   6.56M (152.52ns) (± 4.08%)       fastest

String.gsub("c", "x") faster in all cases (nonexistent character to replace etc.).

…slower than gsubs.

  tr single char string   4.38M (228.22ns) (± 1.14%)  1.50× slower
       gsub single char    5.0M (200.19ns) (± 2.18%)  1.31× slower
gsub single char string   6.56M (152.52ns) (± 4.08%)       fastest
@asterite
Copy link
Member

I think it's better to optimize tr for this case then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants