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

Bunch of speed and memory optimizations #527

Merged

Conversation

krzysiek1507
Copy link
Contributor

I18n::Locale::Fallbacks.new[locale] is faster around 30% and uses around 40% less memory

I18n::Locale::Fallbacks.new[:de]

Before:
Calculating -------------------------------------
            original     1.696k memsize (     0.000  retained)
                        36.000  objects (     0.000  retained)
                         2.000  strings (     0.000  retained)

Warming up --------------------------------------
            original     9.584k i/100ms
Calculating -------------------------------------
            original    100.989k (± 2.9%) i/s -    507.952k in   5.034224s


After:
Calculating -------------------------------------
            original     1.056k memsize (     0.000  retained)
                        20.000  objects (     0.000  retained)
                         2.000  strings (     0.000  retained)

Warming up --------------------------------------
            original    13.143k i/100ms
Calculating -------------------------------------
            original    135.522k (± 3.4%) i/s -    683.436k in   5.049384s
I18n::Locale::Fallbacks.new[:'en-US']

Before:
Calculating -------------------------------------
            original     2.496k memsize (     0.000  retained)
                        55.000  objects (     0.000  retained)
                         4.000  strings (     0.000  retained)

ips benchmark:
Warming up --------------------------------------
            original     6.597k i/100ms
Calculating -------------------------------------
            original     68.147k (± 4.8%) i/s -    343.044k in   5.046789s


After:
Calculating -------------------------------------
            original     1.696k memsize (     0.000  retained)
                        35.000  objects (     0.000  retained)
                         4.000  strings (     0.000  retained)

ips benchmark:
Warming up --------------------------------------
            original     8.169k i/100ms
Calculating -------------------------------------
            original     87.410k (± 2.7%) i/s -    441.126k in   5.050400s

@radar
Copy link
Collaborator

radar commented May 31, 2020

Thanks very much :)

@radar radar merged commit 3162a48 into ruby-i18n:master May 31, 2020
@krzysiek1507 krzysiek1507 deleted the fix/speed-and-memory-optimizations branch June 1, 2020 07:18
@krzysiek1507
Copy link
Contributor Author

You're welcome! ;)

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

Successfully merging this pull request may close these issues.

2 participants