Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/glsPublic
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

remove mutex lock in a goroutine lifecycle#16

Open
HyungrakJo wants to merge4 commits intojtolio:master
base:master
Choose a base branch
Loading
fromHyungrakJo:remove_lock_in_a_go_lifecycle

Conversation

HyungrakJo
Copy link

@HyungrakJoHyungrakJo commentedAug 11, 2022
edited
Loading

There is a performance loss due to mutex locks in situations where goroutines are frequently created/exited.

  1. I used lock free pool as goroutine id pool.
  2. In order to get the "Values" corresponding to the goroutine id, I made it possible to access without contention by using a pre-assigned array instead of map. It is assumed that the array can grow variably and holds write locks only when it needs to be grown.

It was confirmed that there is a significant performance difference by modifying the benchmark test case.

  • before
BenchmarkGetValue-10        2514    551195 ns/opBenchmarkSetValues-10        6830    166487 ns/op
  • after
BenchmarkGetValue-10        4240    505839 ns/opBenchmarkSetValues-10       15340     76396 ns/op

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@HyungrakJo

[8]ページ先頭

©2009-2025 Movatter.jp