Add an index of refs to each destination for faster lookups #77
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.
We were attempting to render a document that had thousands of cells in a massive table, and found that it took a very long time to render.
Profiling revealed that the bulk of the time was spent in running
findElement
inlayout.js
'sappend
function.querySelector
became pretty inefficient when the document got this large. I was able to reduce load times for one of our documents from 20s to 4s by building up an index of refs whileappend
ing nodes and then referencing that index later infindRef
(indom.js
).I thought I'd send this change upstream in case someone else would benefit from the performance. This version just stores the index directly on the DOM node, but I'd be happy to make any changes necessary to get this to fit in better with paged.js's conventions (or, obviously, if there are problems with this caching that I didn't anticipate).