Limit fm_renumber traversal to repeatables #830
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.
This is a performance improvement to fm_renumber. It works by limiting the
fm-wrapper
elements which getdata-fm-array-position
attributes to only those with limits != 1. In JS, only.fm-element[data-fm-array-position]
elements are traversed. Using a sample group with deep nesting, DOM traversal dropped from thousands of elements to dozens and performance improved about as one would expect.To be clear, this isn't an end-all-be-all fix. DOM traversal in this function is still a problem, and it's still very possible to generate a nesting of groups and fields that blocks the event loop for multiple seconds on sorting, but this should solve 99.9% of real world use cases. Further refinement should be weighed by its opportunity costs, since that time could be better spent on a deeper overhaul using React or VueJS.
Refs #829