Skip to content

Additional optimizations

Created by: nthykier

The primary commit here is "Attempt to reuse results from findReferencedElements better", which reduces runtime for me by about 6%. It does so by attempting to avoid calling findReferenceElements as it is the most expensive function there is. In my case, it reduced the number of calls from 8 to 6 on the root element.

The next two commits rewrite findReferencedElements to an "iterative" variant. In itself, it does not give anything measurable. However, with those applied, it is a lot easier to tell how many times we call findReferenceElements on the root element (as it is now just the number of calls to findReferenceElements).

The last patch simply inlines a loop to remove some call overhead in python. It is not particular measurable, but it does remove the function from the top 3 in the "ncalls" column from profiling. With this, none of the scour.py functions appear in the top 15 of "ncalls" on my sample svg.

Merge request reports

Loading