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

Perform the zoom in/out canvas rendering with Cairo #210

Merged
merged 1 commit into from Jan 20, 2022

Conversation

cameronwhite
Copy link
Member

This still needs some more testing, but has some good performance improvements in the benchmarks

Current

Method Mean Error StdDev Allocated
RenderOneToOne 4.322 ms 0.0942 ms 0.2734 ms 254 B
RenderManyOneToOne 23.601 ms 0.6252 ms 1.8237 ms 850 B
RenderZoomIn 38.219 ms 0.7541 ms 1.8640 ms 28,399 B
RenderManyZoomIn 231.494 ms 5.5985 ms 16.3310 ms 29,184 B
RenderZoomOut 11.879 ms 0.2343 ms 0.3434 ms 288 B
RenderManyZoomOut 108.522 ms 2.2333 ms 6.4079 ms 1,011 B

PR

Method Mean Error StdDev Allocated
RenderOneToOne 4.263 ms 0.0734 ms 0.0651 ms 206 B
RenderManyOneToOne 21.894 ms 0.4364 ms 0.6664 ms 448 B
RenderZoomIn 16.880 ms 0.2621 ms 0.2451 ms 226 B
RenderManyZoomIn 119.798 ms 1.6916 ms 1.5823 ms 579 B
RenderZoomOut 3.944 ms 0.0697 ms 0.0953 ms 203 B
RenderManyZoomOut 31.815 ms 0.6140 ms 1.3607 ms 467 B

This is done by setting up a suitable transform for the source surface, and assigning the proper filter mode (when zooming in, no smoothing should be done).

This simplifies the code quite a bit, and lets us draw directly onto the final surface (avoiding the temporary surface, and the extra copy for transformed layers)
@cameronwhite
Copy link
Member Author

Also attaching the original benchmarks stats for my machine from before the previous PR

Method Mean Error StdDev Allocated
RenderOneToOne 4.065 ms 0.0808 ms 0.2266 ms 246 B
RenderManyOneToOne 21.894 ms 0.4324 ms 0.7105 ms 842 B
RenderZoomIn 65.521 ms 1.2960 ms 2.5583 ms 28,430 B
RenderManyZoomIn 596.972 ms 11.3052 ms 15.4747 ms 29,936 B
RenderZoomOut 11.486 ms 0.2278 ms 0.3547 ms 277 B
RenderManyZoomOut 106.560 ms 2.1096 ms 2.7430 ms 1,219 B

@cameronwhite cameronwhite merged commit 8b69e83 into master Jan 20, 2022
@cameronwhite cameronwhite deleted the feature/canvas-speedup branch January 20, 2022 03:11
@jpobst
Copy link
Contributor

jpobst commented Jan 20, 2022

Very nice, definitely feels faster to use!

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

Successfully merging this pull request may close these issues.

None yet

2 participants