Closed computablee closed 1 year ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
c7eec2c
) 99.19% compared to head (5ea0102
) 99.11%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Which issue are you addressing?
Closes #110
How have you addressed the issue?
Using
ThreadLocal<T>
, the thread num is only calculated withToInt32
once, and from thereon is cached as a thread-local variable.How have you tested your patch?
A new
Misc
benchmark was added. Omitting the time to callInParallel()
, the newGetThreadNum()
runs in about 11ns, whereas the old took about 24ns. Negligible performance improvement for most code, but could be beneficial ifGetThreadNum()
is called millions or billions of times in a tight loop over the course of an application.Of course, all unit tests still pass.