title: WCF REST, PerCall, Castle.Core interceptor performance issue
body: <p>I have n-tier application where the "WCF REST Service Application" is in the top. For performance consideration, the context mode is PerCall such as the following</p>
  
  <pre><code>[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  </code></pre>
  
  <p>I also have a Intercept (Castle.Core) for logging purposes in the same way like this:</p>
  
  <ul>
  <li><a href="http://docs.castleproject.org/Default.aspx?Page=Interceptors&amp;NS=Windsor" rel="nofollow">Interceptors</a></li>
  <li><a href="http://ayende.com/blog/3474/logging-the-aop-way" rel="nofollow">Logging the AOP way</a></li>
  </ul>
  
  <p>The implementaion:</p>
  
  <pre><code>public static readonly ProxyGenerator generator = new ProxyGenerator();
  
  public static T Create&lt;T&gt;(object target, ILog log)
  {
      return (T)generator.CreateInterfaceProxyWithTarget(typeof(T), target, new LoggingInterceptor(log));
  }
  
  private class LoggingInterceptor : IInterceptor
  {
          ...
  }
  </code></pre>
  
  <p>The interceptor:</p>
  
  <pre><code>IUserHandler handler = ObjectFactory.Create&lt;IUserHandler&gt;(new UserHandler(), log);
  
  handler.GetUsers();
  </code></pre>
  
  <p>By using interceptor each method calls have about 0,3 additional seconds which is quite a lot. Why is it?! Is there another way to get interceptor working without such huge performance overhead?!</p>