Repository navigation
Conversation
|
Thank you @TaylorHo. This looks interesting. Please split this into multiple PRs that target a specific kind or area of optimization. I would be especially curious to see what effect tracking texture units in the state has and the extra sorting of scene renderables. Please leave the renderable culling out, I am about to do a PR that handles it a bit more general so it also works for multi-sample (will ping you as a reviewer). I don't think the uniform optimization works. You will need to re-upload them when ever the program changes and are careful not to do so unnecessarily, see RenderItem.render. What helps with reducing uniform calls is UBOs (webgl2 only). I have a prototype for it and it helps a little here. |
dsehnal
left a comment
There was a problem hiding this comment.
Thanks for going through this.
|
|
||
| reset: () => { | ||
| enabledCapabilities = {}; | ||
| for (const k of Object.keys(enabledCapabilities)) { |
There was a problem hiding this comment.
Is this really faster than allocating a single new object?
|
|
||
| // Fast path: same number and all current refs are still in effective. | ||
| if (current.length === effective.length) { | ||
| const effectiveSet = new Set(effective); |
There was a problem hiding this comment.
Have a reusable set that you clear?
Sure! I'll review your comments and split this into smaller PRs this week. Thanks in advance for the invite to the repo! |
…rial maps, reused maps) (#2042) - CIF: toDatabase with aliases flattens the frame once for all tables - chain-id, entity-id, operator-hkl color themes cache their serial maps in the structure's currentPropertyData (entity-id on the structure itself, its source serials come from that structure's models) - Stats.handleElement and Loci.extendToRadius reuse their maps; extendToRadius keeps a fresh index array per unit, makeIndexSet keeps it as the loci's indices - relinkCells: a Set for the fast path only past 8 dependencies Left out from #1932: the GL and Canvas3D changes (WebGPU work), the representation renderObjects cache (stale when only `visuals` changes), the shared scratch arrays (aliased into returned loci, or across awaits), the CIF list-column row cache, the PDB helix loop. Co-authored-by: Taylor Hoffmann <taylor@hoffmann.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Description
Optimized the viewer rendering hot path to reduce redundant GPU/CPU work during rendering.
Changes
ValueCellvalues have not changed.Results
Canvas3D.renderCPU time.DrawPass.renderCPU time.These changes significantly reduce CPU rendering overhead and improve worst-case frame hitches, while also providing moderate GPU improvements.
Actions
[Unreleased]section ofCHANGELOG.mdpackage.json'scontributorsdocs