Add a four-element AsyncLocalValueMap type (#68790)
authorStephen Toub <stoub@microsoft.com>
Thu, 5 May 2022 01:11:18 +0000 (21:11 -0400)
committerGitHub <noreply@github.com>
Thu, 5 May 2022 01:11:18 +0000 (21:11 -0400)
commit16b6369b7509e58c35431f05681a9f9e5d10afaa
tree767e45c37c955ad7698724dcd40cd6f1960da485
parentf9a459ef863e2436305662343f641e5e2a0c95b3
Add a four-element AsyncLocalValueMap type (#68790)

* Add a four-element AsyncLocalValueMap type

We previously special-cased up to three active AsyncLocals in a given async flow, but it seems four is also very common.  Special-casing four as well results in four using ~20% less allocation and ~10% less CPU overhead.

* Fix downgrading to FourElementAsyncLocalValueMap, and clean up source
src/libraries/System.Private.CoreLib/src/System/Threading/AsyncLocal.cs