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

chore: improve render string performance #2365

Merged
merged 2 commits into from May 9, 2020
Merged

chore: improve render string performance #2365

merged 2 commits into from May 9, 2020

Conversation

appleboy
Copy link
Member

@appleboy appleboy commented May 9, 2020

testing repo: https://github.com/appleboy/web-framework-benchmark

before

script:

$ go get github.com/gin-gonic/gin@v1.6.3
$ go test -bench=. -benchtime=10s

result:

BenchmarkGinStatic-8               23306             50344 ns/op            8283 B/op        157 allocs/op
BenchmarkGinGitHubAPI-8            16506             71542 ns/op           10801 B/op        203 allocs/op
BenchmarkGinGplusAPI-8            284379              4061 ns/op             685 B/op         13 allocs/op
BenchmarkGinParseAPI-8            153843              7657 ns/op            1361 B/op         26 allocs/op

after

script:

$ go get github.com/gin-gonic/gin@1bd5a8f
$ go test -bench=. -benchtime=10s

result:

BenchmarkGinStatic-8              246488             46740 ns/op            9915 B/op        314 allocs/op
BenchmarkGinGitHubAPI-8           176192             65348 ns/op           12940 B/op        406 allocs/op
BenchmarkGinGplusAPI-8           3298646              3747 ns/op             811 B/op         26 allocs/op
BenchmarkGinParseAPI-8           1683153              7003 ns/op            1620 B/op         52 allocs/op

@appleboy appleboy added this to the 1.7 milestone May 9, 2020
@appleboy appleboy requested a review from thinkerou May 9, 2020 06:55
@codecov
Copy link

codecov bot commented May 9, 2020

Codecov Report

Merging #2365 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2365   +/-   ##
=======================================
  Coverage   98.48%   98.48%           
=======================================
  Files          41       41           
  Lines        2305     2305           
=======================================
  Hits         2270     2270           
  Misses         20       20           
  Partials       15       15           
Impacted Files Coverage Δ
render/text.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82b284f...8c17fe9. Read the comment docs.

Copy link
Member

@thinkerou thinkerou left a comment

Choose a reason for hiding this comment

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

lgtm

@thinkerou thinkerou merged commit 6f3d96c into master May 9, 2020
@appleboy appleboy deleted the render branch May 9, 2020 09:49
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