Skip to content

Multithreading - Is the wrapper Threadsafe ? #191

@CanadianHusky

Description

@CanadianHusky

Hello,

Is the underlying native library, the csharp binding and wrapper thread safe ? Or are there heavy synclocks or semaphore locks or similar ?

I am experiencing major bottleneck in .Net Framework 4.8 when using the wrapper over Task.Run() with 12/24 core CPUs
I can prepare minimal code sample if required, but in essence the comparison is between

1-
Task.Run() for Page.GetPixmap on 12 to 24 threads using the wrapper

2-
Same function (render pdf to image with same parameters), but launched as fully separate Processes using mutool.exe draw using shell Process.Start(), which is like a command line execution, again launched inside Task.Run()

Result:
the command line with Process.Start("mutool.exe") is over 10! times (not 10%) faster, despite the overhead of launching a new shell process every time.

Observations:
The shell process uses 100% CPU time as expected on all cores (Task Manager > Performance).
The wrapper hovers around 10 to 40% CPU time, the CPU is not utilized fully, despite the task being fully CPU bound.
No worthwhile Memory usage or limit or no heavy HD exists. Operation is fully CPU bound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions