You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-5
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,14 @@
1
1
# ⚡ Lightweight.Caching
2
2
3
-
A lightweight caching library.
3
+
A lightweight high performance caching library with simple cache primitives suitable for use on the hot path.
4
+
5
+
## Meta-programming using struct for JIT dead code removal and inlining
6
+
7
+
ConcurrentLru features injectable policies defined as structs. Since structs are subject to special optimizations by the JITter, the implementation is much faster than if these policies were defined as classes. Using this technique, lookups without TTL are within 15% of the speed of a ConcurrentDictionary.
8
+
9
+
Since DateTime.UtcNow is around 4x slower than a ConcurrentDictionary lookup, policies that involve time based expiry are significantly slower. Since these are injected as structs and the slow code is optimized away, it is possible maintain the fastest possible speed for the non-TTL policy.
0 commit comments