perf: streamline cell content generation - #4724
Open
lukecotter wants to merge 1 commit into
Open
Conversation
Collaborator
|
Hey! Was the previous implementation causing some issues for you? |
Contributor
Author
|
@rathboma This speeds up rendering quite a bit for me especially when the virtual renderer is not being used. If you want I can provide some timings. |
lukecotter
force-pushed
the
perf-cell-render
branch
from
July 2, 2026 20:39
113f48f to
6ad2576
Compare
lukecotter
force-pushed
the
perf-cell-render
branch
from
July 3, 2026 09:57
6ad2576 to
b150347
Compare
Two changes to Cell._generateContents: - The cell-format fallback set element.innerHTML = value AND returned it, then the switch default wrote innerHTML again (double write on the no-Format-module path). Return the value so innerHTML is written once (~2x on that path). - Clear content via a removeChild loop (_clearCellContent) instead of innerHTML="" (~2.6x; no HTML-parser teardown). The common path (formatted string -> default: innerHTML = val) is unchanged. Uses only long-standing DOM APIs.
lukecotter
force-pushed
the
perf-cell-render
branch
from
July 3, 2026 16:11
b150347 to
4adecdb
Compare
Contributor
Author
|
Part of #4917 (overview + combined numbers). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two changes to
Cell._generateContents:innerHTMLonce instead of twice — the fallback setinnerHTML = valueand returned it, then theswitchdefaultwrote it again.removeChildloop (_clearCellContent()) instead ofinnerHTML = "".Behaviour
Unchanged — Format tests pass. The common formatted-string path (
default: innerHTML = val) is untouched. No new browser requirements.Performance (isolated, 250k renders; jsdom, directional)
innerHTML=""→removeChild) 1257 → 489 ms (~2.6×).Grid impact
Negligible — with the Format module present the common path is unchanged, so full-grid render is unaffected (headless Chromium, virtual renderer). The win applies to no-Format builds and cell-clear paths. Baseline
upstream/master@9539446.