typesupply / lasermeasure

A laser measure tool.
MIT License
10 stars 1 forks source link

Optimize for lettering. #17

Closed typesupply closed 2 years ago

typesupply commented 2 years ago

It seems slow in lettering use. Maybe there is a ton of iteration happening? Maybe the mouse moved could be coalesced more coarsely?

typesupply commented 2 years ago

The bottleneck is in the point-to-point algorithm. It's testing every point with every point. In the case of lettering, there are a lot of points so this creates a long iteration. Perhaps this could be optimized by iterating through points based on their distance from each other and when the other conditions are met, return the hit.

15 is related.

typesupply commented 2 years ago

Reopening...


The bottleneck is still present in a glyph with 1347 segments. Maybe the full combination of all points isn't needed. Perhaps the N closest points to the cursor could be found and then combined. This would eliminate caching, but maybe that could be overcome by caching grid sections.