This has been one of the biggest improvements and cumulative optimization changes to our DICOM toolkit since the beginning. We are proud to announce the performance enhancements starting from builds [DicomObjects .NET - 8.40.202] & [DicomObjects .NET Core - 5.0.8]. These changes will be included only in the Development builds (until their respective incremental LTS version is released). Pre-released LTS versions will not get this update because of breaking changes and API updates which wouldn’t be sensible to be added this late.
We have done some extensive benchmarking comparison of our release versions and the build after these optimization changes. To give you a summary of the performance changes we have included some results below.
In our tests, we are comparing DicomObjects load times and memory usage. We are using BenchmarkDotNet Nuget package for all our tests. A small but very important difference between DicomDataSet and DicomImage is that the pixel data and display related properties are not loaded immediately, (lazy loading/on-demand loading is the default behaviour, when using DicomDataSet as opposed to DicomImage which loads everything in advance, especially if the input source is not a FileStream (passed as a string ‘Filename'). This doesn’t apply to DicomObjects .NET Core, as it doesn’t have DicomImage or other viewing capability.
Starting with a simple read comparison, this result below shows different ways of reading in the data (namely Filename, Byte array or Stream object) and the input data is a collection of single-frame and multi-frame images.
Read Operation Execution time & Memory usage comparison
|Optimized vs Pre-optimization Read only Execution time|
|Optimized vs Pre-optimization Read only Memory usage|
Read-Write Execution time & Memory usage comparison
A more comprehensive test would be to read the data, transcode it into another TransferSyntax and then write it out to disk and we are glad to say that is showing massive improvements too:
|Optimized vs Pre-optimization Read-Write Execution time|
|Optimized vs Pre-optimization Read-Write Memory usage|
Extended test result compared against 3rd party DICOM tools
We also tested these optimization changes against another third-party DICOM library available on Nuget to see how they compare:
|Optimized vs Third-party Read-Write Execution time|
|Optimized vs Third-party Read-Write Memory usage|
Stress test result
Furthermore, we made additional optimization to the codecs and the improvement has been significant. Compression/decompression of images in different transfer syntaxes would be very much benefitted by this as you can see in the benchmark results below of a multi-frame image compressing (Write) and decompressing (Read) to and fro all the Transfer Syntaxes supported in our toolkit. These codec improvements are only available in .NET CLR 4.8 and NET 5 (Core) and above versions of our toolkit.
|Optimized vs Pre-optimization compression test|
*Note these are test results of DicomObjects .NET library, results of DicomObjects .NET Core library are very similar but not included here.
We strive to keep improving and enhancing our toolkit for our users to get the best out of our library and utilize the latest framework improvements. Please feel free to try out the latest development versions DicomObjects .NET & DicomObjects .NET Core.