Get the latest tech news

Unintuitive optimization for performing paths union


There is a weird optimization possible when one wants to compute the contour of a lot of vector paths. Here I try to explain why it works.

Considering that it’s difficult to do union in general and that Skia has had years of engineering put into it for achieving great performance everywhere, it’s understandable one might conclude that this is just the way it is. Keeping in mind that the union operation is commutative, one trivial “fix” could have been just distributing the work across multiple threads, and then combining the results. And since we’ve seen that the runtime performance of path ops depends a lot on the number of segments, this gives a very good hint for why it’s so slow in our case.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of paths union

paths union