-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
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.
maioral