Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Chore: Apply memoization to config creation within glob utils #9944
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
What changes did you make? (Give an overview)
I attempted a brief review of
Running the repo's
In this branch, the above ignored-paths steps only occur once.
Anecdotally, I have been seeing pretty consistent gains in the
That all said, what I have done is prevent a new object creation (due to its cost and loss of referential equality) when it's unnecessary.
Then once that has been done, since I noticed these executions are more likely to be similar than different, I included two small, memoized functions to help create this object, and get a new instance of the
Is there anything you'd like reviewers to focus on?
Thanks for the PR! To clarify, does this just memoize the creation of the
@not-an-aardvark that is correct.
To your point, I'm not sure how some of the editor integrations happen, but if they're long-running, and if it's possible that this options object gets mutated upstream, we might provide an old response due to a false positive on referential equality. I'm imagining this is not the case though.
As far as I remember, there are a few projects that use long-running eslint through APIs. I think VSC uses eslint-server which keeps eslint process running in memory. There's also eslint_d project that does the same. So if this might result in memory leak for long-running instances, this might cause problems.
Alright, I've updated -- now the memozation only runs for the duration of the
Theoretically the code is improved and could be merged as such with minimal risk, or I can continue looking into this.