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

test: improve gopool benchmark #35

Merged
merged 2 commits into from
May 23, 2021
Merged

test: improve gopool benchmark #35

merged 2 commits into from
May 23, 2021

Conversation

zhangyunhao116
Copy link
Member

@zhangyunhao116 zhangyunhao116 commented May 23, 2021

This PR improve two points:

  • Makes the benchmark scalable. The previous benchmark use math/rand, it is wrapped by a sync.Mutex, so only one CPU can be used in the test function.
  • Benchmark gopool in copystack situation. After makes the benchmark scalable, the gopool's speed almost equal to the std go, but consumes 10x memory.

(testFunc trigger copystack)
name time/op
Pool-12 4.03ms ± 3%
Go-12 9.33ms ± 0%

@zhangyunhao116 zhangyunhao116 self-assigned this May 23, 2021
@zhangyunhao116 zhangyunhao116 requested a review from lyeeeeee May 23, 2021 06:18
@zhangyunhao116 zhangyunhao116 merged commit 91ae895 into develop May 23, 2021
@zhangyunhao116 zhangyunhao116 deleted the test/gopool branch May 23, 2021 06:40
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.

3 participants