Poor performance of concurrent Graphics.RotateTransform operations

前端 未结 2 680
陌清茗
陌清茗 2021-01-15 03:46

Why don\'t I see a significant speed increase when running concurrent Graphics.RotateTransform operations across multiple threads?

This example demonstrates the mar

2条回答
  •  耶瑟儿~
    2021-01-15 04:04

    The problem is that those GDI+ calls block per process (not per thread), so even though the threads are running in parallel, the calls to graphics.... cause other threads to block. Meaning it ends up processing nearly serially.

    See various answers in the question below for workarounds, the top one suggesting creating separate processes. Looks like you might end up just creating a helper command line utility or something. You might even be able to get fancy hook up the stdin and stdout so you could pass the image to rotate and get back the new image with out IO operations.

    Parallelizing GDI+ Image Resizing .net

提交回复
热议问题