Possible performance improvement

  • Hi Marcel,


    I hope you are well?


    Recently I did some profiling of the DICOM library code and found that the "Array" class can be optimized. At the moment this is implemented as a linked list, causing quite some overhead when looping over the elements using the Get(Index) function as is the case in e.g. PresentationContext::Size(). After converting this code to a plain array (reallocating it in chunks as the buffer grows), I was able to reduce the time needed to load a CT volume by approximately 20%. This also reduces the code in array.tcc quite a bit as finding an element can simply be implemented as e.g.: return *(first_dyn[IndexIn]) instead of having to follow links to the right node in several steps. This update also implies trivial changes to deivr.cxx and qrsop.cxx as the "DataLink" class will no longer be available. If you are interested I can upload the array.tcc and array.thh files (and deivr.cxx/qrsop.cxx as well) to this forum or perhaps the GitHub location?


    Best regards,


    Lennert.

  • Here you go. For your convenience I included the full source code to deivr.cxx, qrsop.cxx and dgate.cpp next to the updated array.thh/tcc although just a couple of lines of code changed. Please let me know if you encounter any issues.

  • Hi Marcel,


    It seems my code is not completely ready for prime time use, I am afraid. As pointers are being copied there seems to be an aliasing problem. As soon as I have this resolved I will let you know!


    Best regards,


    Lennert.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!