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

[8_12] improve strategy of expanding string for performance #331

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

jingkaimori
Copy link
Contributor

see also #305

Performance

operator<< faster 2-3x than before

Before

ns/op op/s err% total benchmark
35.13 28,463,649.27 3.9% 0.22 construct string
2.66 376,488,992.00 1.7% 0.24 equality of string
17.68 56,561,986.49 1.0% 0.23 equality of larger string
4.14 241,610,858.14 0.9% 0.24 compare string
8.09 123,542,843.98 2.1% 0.24 compare larger string
18.23 54,847,647.47 0.6% 0.24 slice string
24.93 40,119,524.68 2.0% 0.24 slice string with larger range
31.80 31,447,902.44 0.9% 0.24 concat string
16.71 59,850,717.22 2.5% 0.24 append string
3.17 315,195,579.00 0.5% 0.24 is quoted

After

ns/op op/s err% total benchmark
33.35 29,984,690.73 2.4% 0.23 construct string
2.64 378,639,521.02 2.0% 0.24 equality of string
15.69 63,733,330.98 3.0% 0.23 equality of larger string
4.22 236,987,827.04 3.2% 0.25 compare string
8.50 117,694,065.06 3.1% 0.24 compare larger string
22.21 45,014,771.61 3.7% 0.23 slice string
25.88 38,644,124.66 0.3% 0.24 slice string with larger range
30.28 33,028,549.24 0.9% 0.24 concat string
6.81 146,814,049.22 3.7% 0.23 append string
3.20 312,586,648.76 0.7% 0.23 is quoted

@jingkaimori jingkaimori requested a review from da-liii June 6, 2024 16:02
Copy link
Contributor

@da-liii da-liii left a comment

Choose a reason for hiding this comment

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

LGTM

@da-liii da-liii changed the title improve strategy of expanding string for performance [8_12] improve strategy of expanding string for performance Jun 7, 2024
@da-liii da-liii merged commit 30170ac into main Jun 7, 2024
12 checks passed
@da-liii da-liii deleted the jingkaimori/string-backport branch June 7, 2024 09:08
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