Speed up StyleContextStack.autopush() for large tables
Speed up StyleContextStack.autopush() for large tables by skipping slower creation of styleOverrideObject and just using the item itself.
Three tests are updated to handle the change in behavior.
Implements #2732
Looks like the two build errors are build (not code) issues?
Error: Unable to find Node version '12.x' for platform darwin and architecture arm64.
Error: Unable to find Node version '12.x' for platform darwin and architecture arm64.
It is error in GitHub Action, no problem.
According to your edits, you remove style properties filtering. This is unwanted behavior.
Right. The style properties filtering is really slow over many table rows. Other methods (reduce, destructuring, etc.) don't seem to speed it up. [Reduce is slower, destructuring same speed.]
StyleContextStack.autopush() is used only in StyleContextStack.auto(), and only to push items, do callback, and then pop those items. So this is about a tradeoff; seems like little benefit of filtering for this operation, and the speedup is significant (especially because DocMeasure.measureTable() ends up calling StyleContextStack.auto() twice per row, which is another issue).
I can't find any code that would end up enumerating the style context stack, and none of the callbacks appear to be under user control, so I don't think this change would really leak info. If this tradeoff is unacceptable, then this PR is not needed. Or perhaps a different StyleContextStack.auto(), or different measureNode(), is needed for table rows.
I don't know if this filtering is necessary.
It doesn't really seem to matter. Merged. Thanks.