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
Drawing many annotations is very slow #66
Comments
Luckily, I already found a way to optimize this heavy bottleneck, and it runs waayyy faster. My theory was that the "update_annot" call has a lot of overhead, so my idea was to batch the calls. How the code works right now:
If you have 1000 lines on the page (which is not strange for when you have hand-drawn pages like in a diary), there will be 1000 calls to My alternative idea is to batch the lines per tool configuration, so if for example the user drew 960 lines with the "pen" tool with width=medium and 40 with the "pen" tool with width=large, then there will only be two calls to
I simulated this approach without the per-tool batching, so I just defaulted all lines to the same pen configuration and the performance improved drastically! This is a very promising speedup. |
I tried converting my private diary which has over 250 pages of hand-written text. It takes well over two minutes on my high-end PC to convert this file to PDFs.
The primary bottleneck lies in drawing the line segments, see the "update_annotations" call below.
See this code: https://github.com/lucasrla/remarks/blob/master/remarks/conversion/drawing.py#L178
The text was updated successfully, but these errors were encountered: