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 of locale data #14

Closed
wants to merge 2 commits into from
Closed

Conversation

sergle
Copy link

@sergle sergle commented Feb 21, 2017

Hi
In my code I have found that after removing unused locales it frees ~10Mb of RSS memory of process.
Here I'm trying to load locale data on demand - similar to DateTime::TimeZone
Commits includes full list of generated pm-per-locale files.

@autarch
Copy link
Member

autarch commented Feb 25, 2017

I wonder if there's a way to do save memory without having to move everything out into separate files. For example, rather than putting the locale data in __DATA__ it could go in the file some other way and we could manually read the data using seek as needed.

@autarch
Copy link
Member

autarch commented Feb 25, 2017

Hmm, I wrote the previous comment and then I remembered e1a4063

@sergle
Copy link
Author

sergle commented Feb 25, 2017

Maybe just store data into separate file, not in DATA. But the one problem I see - how to find it's location from code. Any suggestions?

@autarch
Copy link
Member

autarch commented Feb 25, 2017

I was thinking of that too. It could even be one file per locale. Mostly what I'd like to avoid is shipping hundreds of namespaces, since each namespace you create also uses memory. I think File::ShareDir would be the right tool for this job.

@sergle
Copy link
Author

sergle commented Feb 27, 2017

@autarch could you help me with Dist::Zilla and File::ShareDir? How to use local directory during tests? How to install this directory?
I have never used Dist::Zilla before.

@autarch
Copy link
Member

autarch commented Mar 4, 2017

I think you just need to add [ShareDir] to the dist.ini - see https://metacpan.org/pod/Dist::Zilla::Plugin::ShareDir

@sergle sergle force-pushed the lazy-load branch 3 times, most recently from 5170d6a to e19368c Compare March 6, 2017 12:09
@sergle
Copy link
Author

sergle commented Mar 6, 2017

Sorry for the mess with commits. Should I create a new PR from the fresh fork?

@autarch
Copy link
Member

autarch commented Mar 6, 2017

You can just rebase the branch.

Using File::ShareDir for locale data
@autarch
Copy link
Member

autarch commented Mar 13, 2017

I ended doing my own version of this in #17. Thanks for suggesting this!

@autarch autarch closed this Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants