-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fast Remove #610
Comments
I hacked together something for this today and this was 10x faster than the current way on the |
I was talking with Titian at tsconf and it seems I could maybe take advantage of the incremental parser here. The function of interest seems to be |
Hey, we have an autogenerate file with over 200,000 lines of code, and removing nodes from this file has become impossible due to heap limit issues... :/ I tried forgetting nodes, batching node removal, etc but nothing works. Im thinking will have to resort to straight up string manipulation :/ |
For more context, it doesnt outright not work, i iterate various nodes (both while analyzing and already filtered in an array) and at around 40 nodes removes, the heap limit is reached. I also tried reassigning/re-reading the file and project to the variable, hoping the JS garbage collector would clear some space, but it didn't work. |
As part of the future performance improvements, working on improving the
#remove()
method's performance might be a good start.On remove, the following happens today:
A better solution, but a bit more complicated would be:
#statements
and#_children
when removing a statement)pos
andend
properties. Also, remove stuff like symbols and such (need to investigate more)Not having to reparse and fill the wrapped nodes with new nodes should improve the performance big time. This change will have no effect on the public API.
Note: The tests for these should do a deep search of the final AST to ensure the previous compiler node isn't remaining inside the AST somewhere and that no symbols exist hidden within the
AST
. I'll need to edit private and internal data in the nodes to do this.When adding this, be sure to add some metrics to the project specifically for this scenario (need line graph showing performance over every commit... do worst case and best case on some generated data).
The text was updated successfully, but these errors were encountered: