Skip to content
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

Lazy load samples cache until Classifier is used #4540

Merged
merged 1 commit into from
May 31, 2019

Conversation

jhawthorn
Copy link
Contributor

samples.json is a very large (3.7M) json file, which allocates 183209 ruby strings, which takes 8.2MB of memory according to memsize_of.

Instead of keeping the cache around when loading language.rb, we can instead just load the JSON and allow it to be GC'd after we use it. Cache will still be used if the Classifier is invoked.

samples.json is a very large (3.7M) json file, which allocates 183209 ruby
strings, which takes 8.2MB of memory according to memsize_of.

Instead of keeping the cache around when loading language.rb, we can
instead just load the JSON and allow it to be GC'd after we use it.
Cache will still be used if the Classifier is invoked.
@jhawthorn jhawthorn changed the title Lazy load samples cache until Classifier isn't used Lazy load samples cache until Classifier is used May 28, 2019
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Sidenote: I plan on making a new release this week so there's no need for you to worry about doing it. Just waiting on @ksolo and #4531

@lildude lildude merged commit 071e04a into github-linguist:master May 31, 2019
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants