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

Dynamic flags #4

Merged
merged 10 commits into from
Mar 23, 2016
Merged

Dynamic flags #4

merged 10 commits into from
Mar 23, 2016

Conversation

mwitkow
Copy link
Owner

@mwitkow mwitkow commented Mar 22, 2016

Add flags with Set and Get functions that use atomic pointers to update values.

These are slightly slower, but guarantee race-free without locking.

Benchmark_Duration_Dyn_Get-8    1000000000           3.15 ns/op
Benchmark_Duration_Normal_get-8 2000000000           0.28 ns/op
Benchmark_Float64_Dyn_Get-8     1000000000           3.55 ns/op
Benchmark_Float64_Normal_Get-8  2000000000           0.45 ns/op
Benchmark_Int64_Dyn_Get-8       1000000000           3.39 ns/op
Benchmark_Int64_Normal_Get-8    2000000000           0.37 ns/op
Benchmark_String_Dyn_Get-8      100000000           41.5 ns/op
Benchmark_String_Normal_get-8   100000000           36.2 ns/op

This should fix #3

@mwitkow mwitkow merged commit 061778b into master Mar 23, 2016
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.

Remove races due to using plain pointers
1 participant