Apply all folds in one update #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "andreimokrousov/language:bulkfoldupdate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR deals with one problem - transactions with a large number of
foldEffects are very slow (For example, folding all foldable ranges of 10MB json (~130K ranges) takes about 10-15s on my machine; in contrast, unfolding them all takes only 1-2s)I believe that the root of the problem is updating ranges one-by-one in this line
folded.update({add: [widget.range(e.value.from, e.value.to)]}), because every call re-creates RangeBuilder and iterates through every existing fold, effectively making such transaction quadratic by foldEffect count.In this PR I group all ranges that should be folded, and apply them all at once.
This reduces the time from 10-15s to <1s in my case.
Please take a look at this patch and kindly tell if it can be merged. Thanks!
WIP: apply all folds in one updateto apply all folds in one updateapply all folds in one updateto Apply all folds in one updateOh right, yes, that would be quadratic. Having that many folds come in at the same time wasn't something I considered. The patch looks good, but could you make sure the indentation of the if at the bottom uses two instead of four spaces?
Oops, vscode formatter glitched.
I fixed it, thanks!
Thanks!
Sorry for writing into a closed PR. Could you share your plans on releasing a new version of this extension, please?
I've tagged a version 6.12.4. Don't worry about commenting in closed PRs.