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

Faster get/set on sockets #30

Closed
bbkr opened this issue Feb 15, 2016 · 1 comment
Closed

Faster get/set on sockets #30

bbkr opened this issue Feb 15, 2016 · 1 comment

Comments

@bbkr
Copy link

bbkr commented Feb 15, 2016

I found that get/set on sockets are using regexps to match literal strings:

    for ($opt_type) {
        when (/^int$/) { ... }
        ...
    }

This can be converted to

    for ($opt_type) {
        when ( 'int' ) { ... }
        ...
    }

Which is 2x faster (12M/s for regexp vs 25M/s for literal on my machine).

Note that this do not apply to when (/^(binary|string)$/), in this case regexp is 10x faster than when(['binary','string']).

@calid
Copy link
Member

calid commented Mar 28, 2016

Ah, thanks for the heads up. I'll go ahead and incorporate this once I have a moment... unfortunately I may not be able to get to this for a few weeks.

@calid calid closed this as completed in 2bebac1 Feb 26, 2019
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

No branches or pull requests

2 participants