Poor performance of concurrent Graphics.RotateTransform operations

前端 未结 2 657
陌清茗
陌清茗 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:02

    I do not have a answer but some thoughts that may help:

    1. Are your threads running on multiple processors?
    2. How are you measuring performance? Remember that the UI rendering is always single threaded.
    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题