mathandy / svgpathtools

A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
MIT License
557 stars 142 forks source link

Cache arc length #82

Closed SebKuzminsky closed 4 years ago

SebKuzminsky commented 5 years ago

Arc.length() can be very slow. This PR teaches Arc to cache the computed length, so subsequent calls are faster. It verifies the validity of the cache by hashing the arc parameters.

This speeds one particular workload up from 1m 10s to ~4s, and another, larger workload goes from 19m 23s to 6m 40s.