Why the same code in WPF is slower than in Windows Forms?

Posted by Marco Bettiolo on Stack Overflow See other posts from Stack Overflow or by Marco Bettiolo
Published on 2010-04-13T13:55:41Z Indexed on 2010/04/13 14:03 UTC
Read the original article Hit count: 266

Filed under:
|
|
|

I made bunch of benchmarks of the framework 4.0 and older and I can't understand why the same code is slower when using WPF compared to Windows Forms:

This is the code, it has nothing to do with the UI elements:

        Random rnd = new Random(845038);
        Int64 number = 0;
        for (int i = 0; i < 500000000; i++)
        {
            number += rnd.Next();
        }

The code takes 5968ms - 6024ms to execute in Windows Forms and 6953ms in WPF.

Here is the post with the downloadable solution: http://blog.bettiolo.it/2010/04/benchmark-of-net-framework-40.html

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf