Geeks With Blogs
David Paquette CDD (Caffeine Driven Development)

One of my previous posts talked about the performance improvements in WF4.  With the recent release of Visual Studio 2010 / .NET 4 RC1, I thought I would re-run my performance tests to see if there have been any further improvements with the most recent version.

My test is simply timing how long it takes to invoke an empty workflow (an Sequence activity that does nothing) 2,000,000 times.  This test gives us a good idea of the overhead of invoking a workflow.  With .NET 4.0 RC1, I am able to invoke ~275,000 workflows per second (approximately 15% faster than .NET 4 Beta 2).  I’m glad to see that Microsoft has continued to work on improving the performance of WF4. 

Take the WF4 speed test on your computer and let me know your results.  Create a new console application and past in the code below.  Don’t run the speed test in Visual Studio.  Compile the application and run the executable from outside Visual Studio.

   1: using System;
   2: using System.Linq;
   3: using System.Activities;
   4: using System.Activities.Statements;
   5:  
   6: namespace WFSpeedTest
   7: {
   8:     class Program
   9:     {
  10:         static void Main(string[] args)
  11:         {
  12:             Activity activity = new Sequence();
  13:             WorkflowInvoker invoker = new WorkflowInvoker(activity);
  14:             DateTime startTime = DateTime.Now;
  15:             int numberOfInvokes = 2000000;
  16:             for (int i = 0; i < numberOfInvokes; i++)
  17:             {
  18:                 invoker.Invoke();
  19:             }
  20:             DateTime endTime = DateTime.Now;
  21:             double workflowsPerSecond = numberOfInvokes / (endTime - startTime).TotalSeconds;
  22:             Console.WriteLine("Your WF Speed: {0} workflows per second", workflowsPerSecond);
  23:             Console.WriteLine("Press <Enter> to exit...");
  24:             Console.ReadLine();
  25:         }
  26:     }
  27: }

WF4 RC1, now 15% faster than WF4 Beta 2!

Posted on Saturday, February 13, 2010 4:02 AM .NET , Workflow , WF4 , VS2010 | Back to top


Comments on this post: Take the WF4 Speed Test

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © David Paquette | Powered by: GeeksWithBlogs.net