-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storescu.py
is ~35x slower than DCMTK's storescu
when saving ultrasound studies
#650
Comments
See #620 for some optimisations as well as the SCP tutorial. Also Also there's some info in #639 I'll take a look and see what effect deque has, but it might not be suitable |
After reading the notes in #531, I tried adjusting the value of Decreasing Going from 10μs to 1μs did not make a noticeable difference. This on a 2020 MacBook Air with the M1 processor. With this change, |
I also tested this with Is there any downside to making |
Higher CPU usage when messages aren't being exchanged. The medium term plan is to move away from threading so it's probably not worth me adding (another) config option, especially since it is configurable already (if "private"). |
OK, got it. I only use SCU mode, so messages are essentially always being exchanged. I did not notice any increase in CPU usage for my application. I also did a quick test of replacing However, this only made a small speed improvement (5%?). But it seems like a simpler design since you don't need any of the locking features of Good luck on the new non-threading design! |
I submitted PR #651 to address this without having to set |
I have managed to resolve performance issues by changing the windows time resolution. |
Thank you, I did review that change. I am running on Mac, so I don't think this issue applies in my case. The PR that I submitted removes the need to sleep at all when additional events are in the queue ready to be processed, so it is better than making the sleep interval shorter. |
Ohw, did not realiser this is a fix probably for windows only... |
The DUL "reactor" processes events that are sent between the SCU and the SCP. When there are no events in the queue, you need to wait for an event to arrive over the network. The But, when sending (or receiving) a large DICOM, the DICOM is processed as a large number of separate events. If there are more events waiting in the queue to be processed, there is no need to sleep before processing them. Currently, the code sleeps before every event. PR #651 modifies the reactor to only sleep when the event queue is empty. |
Describe the bug
storescu.py
is ~35x slower than DCMTK'sstorescu
when saving ultrasound studies.Expected behavior
I am exporting a 124-frame uncompressed ultrasound DICOM (208MB) to OsiriX Lite running locally on a Mac.
When I use
storescu.py
, it takes 19 sec, but when I usestorescu
, it only takes 0.5 sec.Steps To Reproduce
I did some profiling, and 96% of the time is being spent in
_thread.lock.acquire()
called fromDIMSEServiceProvider::get_msg()
:It looks like calls to
_thread.lock.acquire()
take 1.4ms, on average, which seems very slow.Any ideas on whether this is a configuration issue? Or maybe using
collections.deque
instead ofQueue.Queue
could help? I have read that it can be up to 20x faster (https://newbedev.com/queue-queue-vs-collections-deque).Thank you!
Your environment
The text was updated successfully, but these errors were encountered: