Comment 4 for bug 714731

Revision history for this message
Louis Simard (louis-simard-deactivatedaccount) wrote :

In order to retain Scour's speed, your code could be edited (by you or by another developer) to reverse the checks you make. Instead of iterating over defaultAttributes and checking for the existence of the attribute, you could iterate over the attributes of the element and check in defaultAttributes.

In most cases that would reduce the number of iterations from 38 to something around 5... or 10 for especially verbsoe elements :) But you could add the rest of the attribute defaults from the SVG specification without sacrificing much speed in Scour.

reducePrecision() does get called after removeDefaultAttributeValues(), whoops. After reversing those calls, the canonicalisation to float could be removed. Is there a built-in function in Python that does nothing but return its first argument? :)