This project has moved and is read-only. For the latest updates, please go here.

Big difference in Speed between version 6 and 7

Sep 22, 2016 at 10:21 AM
Edited Sep 22, 2016 at 11:18 AM
I have been using verion 6 for years.
the distort command in the code below is taken about 38 ms. on the same environment with version 7 it takes 200 to 240 ms. Did I do something wrong? do I need to change something in new version?
I use q8-Any-cpu

for test you can create a console application and use this code and switch between 6 and 7. if you use any image you can see the difference in the speed.
class Program
    static void Main(string[] args)

        MagickReadSettings readSettings = new MagickReadSettings();
        readSettings.Format = MagickFormat.Bmp;
        readSettings.Width = 590;
        readSettings.Height = 590; 

        var image = new MagickImage(@"d:\temp\mypic.bmp", readSettings);

        double[] defaultcoordinate =

        var coordinates = defaultcoordinate;

        var distortImageMethod = DistortMethod.Perspective;
        image.VirtualPixelMethod = VirtualPixelMethod.White;

        image.Distort(distortImageMethod, coordinates);


I have found a clue: even in the first versions of 7 - from version to - the process time of the distort with that image is around 40 ms to 70 ms and suddenly from version it jumps to 194 - 200 ms.
Sep 22, 2016 at 1:49 PM
Is distort only slower than it used to be? Or is the whole process slower? Maybe the startup is now slower because of the native library that was added in 101? Can you do the distort in a loop and test what happens?
Sep 22, 2016 at 3:08 PM
I checked it with loop and still all the distort command are over 200 ms. I checked the composite command and it is working as usual

this command : iimage.Composite(colormap, Gravity.Center, CompositeOperator.Displace, string.Format("{0}x{1}", 70, 60));

is executed less than 89 ms which is fast and good but the distort command has unusual performance.
so this is just the distort command which has poor performance.

Thanks for your reply.
Sep 22, 2016 at 6:02 PM
Edited Sep 22, 2016 at 6:10 PM
Which exact version did you see the performance issue. There are a couple version between .22 and .104. This will make it easier to track down why this is happening. It might be caused because I disabled OpenMP so you no longer need to install the C++ redistributable. Can you try it in a parallel for loop?
Sep 23, 2016 at 11:28 AM
this is happening exactly between these two version:

Nov 23, 2015, Alpha

Feb 4, 2016, Alpha

I tested it with parrallel loop, and I can confirm that it works very good. for 10 distort commands the whole time is 500 ms (for each distort is 50 ms four times faster)

But how can I run it fast with single threat and not parallel ?

I also uninstall the c++ redistributable but no changes in performance.
Sep 23, 2016 at 3:25 PM
Magick.NET and lower use OpenMP that will run some operations a bit faster in a single thread. I had to drop support for that to make it possible to use Magick.NET without installing the C++ redistributable. This will mean that you won't get the performance you used to have. And if you handle multiple images at the same time you should get the same performance. I will try and see if I can figure out why the change is this big but that might take me a while.