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

perf: reduce if statement call on " and \ (micro-optimization) #695

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

cesco69
Copy link
Contributor

@cesco69 cesco69 commented Mar 13, 2024

With this PR when a " or \ is into the string, the if statement for surrogate check is not called. This is a little performance improvment

benchmark with focus on small string
master

short string............................................. x 23,456,041 ops/sec ±0.52% (190 runs sampled)
short string with double quote........................... x 13,475,336 ops/sec ±0.55% (189 runs sampled)

PR

short string............................................. x 23,641,068 ops/sec ±0.57% (191 runs sampled)
short string with double quote........................... x 13,703,071 ops/sec ±0.43% (187 runs sampled)

Checklist

With this PR when a  `"` or `\` is into the string, the if statement for surrogate check is not called. This is a little performance improvment

Signed-off-by: francesco <francesco.bagnoli.69@gmail.com>
@cesco69 cesco69 changed the title chore(perf): reduce if statement call on " and \ chore(perf): reduce if statement call on " and \ (micro-optimization) Mar 13, 2024
@Fdawgs Fdawgs changed the title chore(perf): reduce if statement call on " and \ (micro-optimization) perf: reduce if statement call on " and \ (micro-optimization) Mar 13, 2024
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit b07e607 into fastify:master Mar 18, 2024
19 checks passed
@cesco69 cesco69 deleted the patch-2 branch March 19, 2024 07:44
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