-
Notifications
You must be signed in to change notification settings - Fork 10
Save blend time and memory when rendering distant pieces of text #9
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
Conversation
dmitrylyzo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost didn't look on blend itself, because I believe that you just moved it.
Here are the relevant changes: |
403ea49 to
a87c702
Compare
|
Yeah, I looked this. Nm, I read it wrong. |
|
Not exactly. I always search for smallest buffer, but actually detect two kinds of them: one (called So the strategy is: take the smallest buffer which can hold desired memory without growing; if it doesn't exist, take just the smallest buffer to maximize the ability of other parts to re-use other buffers. Essentially re-allocating the buffer should be avoided at all costs to minimize the work for GC IMHO. They're all small enough to not cause significant memory consumption compared to pre-rendered cache later on. |
This happens when e.g. subtitles are displayed simultaneously on top and at bottom.
Before the change subtitles were rendered in the whole bounding rect, which could end up taking the whole viewport.
Now I change this to splitted rendering (splitting the viewport in 3x3 grid and then merging intersecting rects). This reduces memory footprint and blending time for subtitles which have far spaced parts.
Notes
src/SubOctpInterface.cppandsrc/SubOctpInterface.jsare generatedrenderBlendPart()is almost a cut-paste portion ofrenderBlend(), with pretty minimal changes inside