title: Is Observable.Interval useful for high frequency events?
body: <p>I'm using Observable.Interval to test how well a particular piece of client/server code performs at different loads.</p>
  
  <p>But it seems to have some odd behaviour.</p>
  
  <ul>
  <li><code>Observable.Interval(timespan = 0)</code> produces events as quickly as possible, e.g. 8 million events per second. This seems ok.</li>
  <li><code>Observable.Interval(0 &lt; timespan &lt; 1ms)</code> produces only 1 event, and then nothing.</li>
  <li><code>Observable.Interval(1ms &lt;= timespan)</code> produces events at approximately the requested rate, quite heavily quantised, and up to a maximum of only 64 events / second.</li>
  </ul>
  
  <p>I can appreciate it's not necessarily using high res timers underneath, but what is confusing is that it has such completely different behaviour in the three regions.</p>
  
  <p>Is this expected behaviour, or am I using it wrong?
  If it is expected, then is there an alternative to Observable.Interval for simulating high frequency event sources in Rx, or should I just roll my own...?</p>
  
  <p>A short program that demonstrates the behaviour is below:</p>
  
  <pre><code>static void Main(string[] args)
  {
      const int millisecsPerTest = 10000;
  
      var intervals = new[]
      {
          TimeSpan.FromTicks(0),          // 0 -&gt; rate of 8M messages per second
          TimeSpan.FromTicks(1000),       // 0.1ms -&gt; rate of 0
          TimeSpan.FromTicks(20000),      // 2ms -&gt; rate of 64 messages per second (not 500 as expected)
          TimeSpan.FromTicks(1000000),    // 100ms -&gt; rate of 9 messages per second
      };
  
      foreach(var interval in intervals)
      {
          long msgs = 0;
          using (Observable.Interval(interval).Subscribe(
              l =&gt; { ++msgs; },
              e =&gt; Console.WriteLine("Error {0}", e.Message),
              () =&gt; Console.WriteLine("Completed")))
          {
              Thread.Sleep(millisecsPerTest);
          }
  
          Console.WriteLine("Interval: {0} ticks, Events: {1}, Rate: {2} events per second", interval.Ticks, msgs, (int)(msgs/(double)millisecsPerTest*1000));
      }
  }
  </code></pre>