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

Lit performance #128

Open
Bonias opened this issue Jan 28, 2019 · 2 comments
Open

Lit performance #128

Bonias opened this issue Jan 28, 2019 · 2 comments

Comments

@Bonias
Copy link

Bonias commented Jan 28, 2019

I performed few simple Lit benchmarks and it doesn't seems to be as fast as it should and can be. I generated new rails APP with one Post model. See results:

# code w/o LIT [first run] w/o LIT [second run] LIT (hash) [first run] LIT (hash) [second run] LIT (redis) [first run] LIT (redis) [second run]
1 1000.times { |i| I18n.t("new_#{i}") } 0.034 0.040 11.62 0.030 15.734 1.034
2 1000.times { Post.human_attribute_name(:id) } 0.121 0.107 7.042 6.818 11.818 12.060
3 1000.times { I18n.t('new_1', default: ['new_2', 'default']) } 0.059 0.040 6.319 6.214 11.104 11.790

First scenario is the simplest one - translation of 1.000 different keys. First Lit run is slow, but it is acceptable next runs will be fast. The second Lit run with hash storage is as fast as plain I18n. But Lit with redis is 34 times slower.
Second and third scenario is more complex (although nothing unusaual I think). This time ervey Lit run is very slow. It's more than 100 times slower than plain I18n. And Lit with redis is more than 200 times slower than plain I18n.

@Bonias
Copy link
Author

Bonias commented Jan 30, 2019

I performed tests again for #129:

# code w/o LIT [first run] w/o LIT [second run] LIT (hash) [first run] LIT (hash) [second run] LIT (redis) [first run] LIT (redis) [second run]
1 1000.times { |i| I18n.t("new_#{i}") } 0.034 0.040 8.307 0.057 13.013 1.185
2 1000.times { Post.human_attribute_name(:id) } 0.221 0.107 2.073 1.263 7.825 6.412
3 1000.times { I18n.t('new_1', default: ['new_2', 'default']) } 0.059 0.040 0.738 0.058 2.202 1.013

It's slightly better now.

@mlitwiniuk
Copy link
Member

Some initial work has been done in #130

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

No branches or pull requests

3 participants