Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Painfully slow removal of trailing whitespace on save of large files #140

Closed
ArekSredzki opened this issue Mar 11, 2016 · 3 comments
Closed

Comments

@ArekSredzki
Copy link
Contributor

Problem description

If one tries to save a large file with atom, the save is performed asynchronously, and if it is configured to remove trailing whitespace, it will block the entire editor for a painfully long time.

Very often I will have a large JSON file open and out of the practice of good habit, I will regularly hit meta-s to save the file. I will then be forced to take a stroll as the entire renderer window will be blocked for what is often a minute or so.

Today I finally performed a profile of the issue and nailed down the cause.
Here is the result for the reload of a large file (~150,000 lines).
Profiling Result

Suggested changes

Fix Regex

Execution

I'll take a look at this tonight.

@lee-dohm
Copy link
Contributor

I ran into this also with my tabs-to-spaces package which can do similar large-scale replacements on save, see lee-dohm/tabs-to-spaces#16.

@ArekSredzki
Copy link
Contributor Author

@lee-dohm I'll take that into account when I do a deep dive this evening, thanks for letting me know 👍

@maxbrunsfeld
Copy link
Contributor

This has been fixed: atom/whitespace#140. The fix will ship in Atom 1.14.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants
@maxbrunsfeld @ArekSredzki @lee-dohm @winstliu and others