Skip to content

Instantly share code, notes, and snippets.

@kkozmic
Created November 9, 2009 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkozmic/230396 to your computer and use it in GitHub Desktop.
Save kkozmic/230396 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
namespace DP_perf_1
{
using System.Diagnostics;
using Castle.DynamicProxy;
class Program
{
static void Main(string[] args)
{
var generator = new ProxyGenerator();
int i = 0;
var sw = Stopwatch.StartNew();
foreach (var type in typeof(object).Assembly.GetTypes().Union(typeof(Uri).Assembly.GetTypes()).Where(t => t.IsVisible && t.IsInterface && !t.IsGenericTypeDefinition))
{
var target = generator.CreateInterfaceProxyWithoutTarget(type);
i++;
target.GetType();
}
sw.Stop();
Console.WriteLine(i); // 256
Console.WriteLine(sw.Elapsed);
Console.ReadKey(true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment