title: PerformanceCounterCategory.Exists is very slow if category doesn't exists
body: <p>I have kind of library which uses a bunch of its own perf counters. But I want my library works fine even if that perf counters weren't installed.</p>
  
  <p>So I've created wrappers aroung PerformanceCounter and on the first use check if PerfCounter exists or not. If they exists then I'm using native PerformanceCounter instead I'm using a wrapper which do nothing.</p>
  
  <p>So to check perf counter existence I use PerformanceCounterCategory.Exists</p>
  
  <p>The problem is that if there isn't such category then PerformanceCounterCategory.Exists call takes (on my machine) about 10 seconds!
  Needless to say it's too slow.</p>
  
  <p>What can I do?</p>
  
  <p>Code to try it by youself:
      using System;
      using System.Diagnostics;</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var ts = Stopwatch.StartNew();
          var res = PerformanceCounterCategory.Exists("XYZ");
          Console.WriteLine(ts.ElapsedMilliseconds);
          Console.WriteLine("result:" + res);
  }
  }
  </code></pre>