This project is read-only.

Default Implementaions of Caches and Extensions

FastReflectionLib uses the caches based on System.Collections.Generic.Dictionary<TKey, TValue>. When we invoke a FastXxx extension method, the library would retrieve the worker object from the cache container and execute it. If the worker object cannot be found in the cache, a new one would be created by the corresponding factory. In the Benchmarks section we can found that considerable time is "wasted" in searching the cache.

If you have better cache implementation you can replace the build-in one as following:

public class BetterMethodInvokerCache :
    IFastReflectionCache<MethodInfo, IMethodInvoker>
    public IMethodInvoker Get(MethodInfo key) { ... }
class Program
    static void Main(string[] args)
        FastReflectionCaches.MethodInvokerCache = 
            new BetterMethodInvokerCache();

Last edited Jan 26, 2009 at 2:08 PM by jeffz, version 1


No comments yet.