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

Improve performance by reducing allocations #21

Closed
wants to merge 2 commits into from

Conversation

itchyny
Copy link
Contributor

@itchyny itchyny commented Jan 23, 2023

This PR improves the performance by reducing allocations of strings. This is a recreate of #17. Now that fatih/color#124 is resolved and we can set the color without unsafe package, I'd like to suggest performance improvement again after 2.5 years.

name      old time/op    new time/op    delta
Fromat-8    6.43µs ±  0%    3.01µs ±  0%  -53.28%  (p=0.000 n=9+9)

name      old alloc/op   new alloc/op   delta
Fromat-8    6.00kB ±  0%    2.92kB ±  0%  -51.36%  (p=0.000 n=10+10)

name      old allocs/op  new allocs/op  delta
Fromat-8       191 ±  0%        50 ±  0%  -73.82%  (p=0.000 n=10+10)

@itchyny itchyny closed this Dec 5, 2023
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.

1 participant