Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache ScanEdgeCollection in InternalPath #104

Open
antonfirsov opened this issue Nov 13, 2020 · 3 comments
Open

Cache ScanEdgeCollection in InternalPath #104

antonfirsov opened this issue Nov 13, 2020 · 3 comments
Milestone

Comments

@antonfirsov
Copy link
Member

antonfirsov commented Nov 13, 2020

Creation of ScanEdgeCollection can take up to ~7% according to profiler results, so this seems to be a reasonable optimization. Instances shall be keyed by subsampling since y values in ScanEdge-s are rounded to subpixel scanlines.

Related: #103

@antonfirsov antonfirsov added this to the Future milestone Nov 13, 2020
@JimBobSquarePants
Copy link
Member

Do you have any pointers here. I don't really follow the issue.

@antonfirsov
Copy link
Member Author

antonfirsov commented May 5, 2023

Most (all?) IPath implementations cache their tessellation data as an InternalPath member. Whenever we render an IPath (InternalPath) with a given subsampling, we first convert the InternalPath to a TessellatedMultipolygon (which is just a more efficient storage for the points in InternalPath), then create a ScanEdgeCollection which is a data structure that already depends on the value of subsampling.

Assuming it's a common use case to render an IPath multiple times (which might be a wrong assumption! ... we should analyze use-cases), we could create a cache of ScanEdgeCollections inside InternalPath, so we don't need to recreate it on each render run. Since ScanEdgeCollection depends on subsampling, we should cache (int, ScanEdgeCollection) pairs. In fact one pair should be enough, since we don't expect users to switch the subsampling ratio between render runs.

@JimBobSquarePants
Copy link
Member

Just had a read of the code there. You're on your own. Bit too complicated for me just now! 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants