I wrote simple test
- add 100 items to [Collection]
- read 1000000 times from [Collection] randomly
When
- [Collection]==HttpContext.Current.Items it takes 50 ms
- [Collection]==HttpRuntime.Cache it takes 430ms
- [Collection]==HashTable || [Collection]==Dictionaty 170ms
I guess the overhead of HttpRuntime.Cache is sync
I try to change initial capacity of HashTable/Dictionary? but with no success.
Does anyone know what is the reason of this turbo HttpContext.Current.Items? May I create this kind of object to custom cache implementation(of course with sync imply).