-
Notifications
You must be signed in to change notification settings - Fork 93
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
simple lock for threads_used update #321
Conversation
This function (which is used in a test which is failing in both master and this updated version) should measure the cost of this lock. I don't see any measurable difference in performance among the versions: With this PR: ulia> function prog_perf(n)
prog = Progress(n)
x = 0.0
for i in 1:n
x += rand()
next!(prog)
end
return x
end
prog_perf (generic function with 1 method)
julia> @elapsed(prog_perf(10^7))
Progress: 100%|█████████████████████████████████████████████████████| Time: 0:00:04
4.229378385
julia> @elapsed(prog_perf(10^7))
Progress: 100%|█████████████████████████████████████████████████████| Time: 0:00:04
4.185957772 With current stable release: julia> @elapsed(prog_perf(10^7))
Progress: 100%|█████████████████████████████████████████████████████| Time: 0:00:04
4.125580045
julia> @elapsed(prog_perf(10^7))
Progress: 100%|█████████████████████████████████████████████████████| Time: 0:00:04
4.197386729 |
can you test the performance by always locking? I would be in favor of the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #321 +/- ##
==========================================
+ Coverage 93.48% 96.77% +3.29%
==========================================
Files 1 1
Lines 399 559 +160
==========================================
+ Hits 373 541 +168
+ Misses 26 18 -8 ☔ View full report in Codecov by Sentry. |
Simple fix for #317 and #232
This PR has the same effect as #320 but is a simpler modification of the original code. I just added a lock to update
threads_used
. The update ofthreads_used
occurs only twice at most, so this lock is very likely not important for performance.