Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
context: store first canceler child in separate field
Benchmark results: goos: windows goarch: amd64 pkg: context cpu: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz name old time/op new time/op delta CommonParentCancel-12 627ns ± 2% 586ns ± 2% -6.58% (p=0.008 n=5+5) WithTimeout/concurrency=40-12 1.08µs ±16% 1.10µs ± 4% ~ (p=0.222 n=5+5) WithTimeout/concurrency=4000-12 947ns ± 6% 993ns ± 4% ~ (p=0.056 n=5+5) WithTimeout/concurrency=400000-12 877ns ±15% 868ns ± 1% ~ (p=0.151 n=5+5) CancelTree/depth=1/Root=Background-12 61.9ns ± 0% 68.9ns ± 0% +11.37% (p=0.008 n=5+5) CancelTree/depth=1/Root=OpenCanceler-12 439ns ± 1% 297ns ± 0% -32.30% (p=0.008 n=5+5) CancelTree/depth=1/Root=ClosedCanceler-12 219ns ± 0% 229ns ± 0% +4.74% (p=0.008 n=5+5) CancelTree/depth=10/Root=Background-12 2.45µs ± 2% 1.45µs ± 0% -40.91% (p=0.008 n=5+5) CancelTree/depth=10/Root=OpenCanceler-12 3.43µs ± 2% 1.98µs ± 0% -42.34% (p=0.008 n=5+5) CancelTree/depth=10/Root=ClosedCanceler-12 1.23µs ± 0% 1.32µs ± 0% +6.86% (p=0.008 n=5+5) CancelTree/depth=100/Root=Background-12 26.0µs ± 1% 15.1µs ± 1% -41.91% (p=0.008 n=5+5) CancelTree/depth=100/Root=OpenCanceler-12 33.0µs ± 1% 18.7µs ± 0% -43.25% (p=0.016 n=5+4) CancelTree/depth=100/Root=ClosedCanceler-12 11.3µs ± 1% 12.1µs ± 1% +6.32% (p=0.008 n=5+5) CancelTree/depth=1000/Root=Background-12 262µs ± 1% 152µs ± 0% -41.93% (p=0.008 n=5+5) CancelTree/depth=1000/Root=OpenCanceler-12 331µs ± 0% 188µs ± 0% -43.11% (p=0.008 n=5+5) CancelTree/depth=1000/Root=ClosedCanceler-12 112µs ± 1% 119µs ± 0% +6.12% (p=0.008 n=5+5) CheckCanceled/Err-12 11.7ns ± 1% 11.7ns ± 1% ~ (p=0.738 n=5+5) CheckCanceled/Done-12 5.61ns ± 0% 5.60ns ± 1% ~ (p=0.905 n=4+5) ContextCancelDone-12 0.91ns ± 6% 0.91ns ± 6% ~ (p=0.841 n=5+5)
- Loading branch information