i18n-tasks
i18n-tasks copied to clipboard
Painfully slow in rspec with version 0.9.36
We have couple tests using i18n-tasks ( https://gist.github.com/manaka/2a6f32b11853f1f31709247ed682403f ) After update from 0.9.35 to 0.9.36 it takes 73 minutes to finish this tests, before update it takes 1 and half minute. Also same problem with 0.9.35 if switch ruby from 2.7.3 to 3.0.3 or 3.0.2 What can i do to try find source of the problem?
You can run i18n-tasks
under a profiler, such as rbspy or ruby-prof, to identify where it is spending all this time
Install rbspy per these instructions https://rbspy.github.io/
Then, run:
rbspy record bundle exec i18n-tasks health
That's what I gets:
Time since start: 2410s. Press Ctrl+C to stop.
Summary of profiling data so far:
% self % total name
46.12 94.78 block (2 levels) in associate - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/builders/default.rb
25.03 48.66 == - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/ast-2.4.2/lib/ast/node.rb
19.94 19.94 == [c function] - (unknown)
2.85 97.64 upto [c function] - (unknown)
2.31 2.31 respond_to? [c function] - (unknown)
0.76 0.76 to_ast - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/ast-2.4.2/lib/ast/node.rb
0.61 1.53 advance - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/lexer.rb
0.54 0.54 equal? [c function] - (unknown)
0.22 99.85 _racc_do_parse_c [c function] - (unknown)
0.15 0.15 [] [c function] - (unknown)
0.10 0.21 tok - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/lexer.rb
0.10 0.10 hash [c function] - (unknown)
0.10 0.10 (unknown) [c function] - (unknown)
0.09 0.51 new [c function] - (unknown)
0.09 0.17 initialize - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/lexer/literal.rb
0.06 0.19 nest_and_try_closing - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/lexer/literal.rb
0.05 0.11 emit - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/lexer.rb
0.04 0.04 extend_string - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/lexer/literal.rb
0.04 0.18 slice - /Users/manaka/Work/awesome_project/vendor/cache/ruby/2.7.0/gems/parser-3.0.3.2/lib/parser/source/buffer.rb
0.04 0.04 b [c function] - (unknown)
✓ Perfect! Every translation is in use.
✓ Well done! No inconsistent interpolations found.
✓ Good job! All data is normalized
Wrote raw data to /Users/manaka/.cache/rbspy/records/rbspy-2021-12-22-EuQCN5aHkn.raw.gz
Wrote formatted output to /Users/manaka/.cache/rbspy/records/rbspy-2021-12-22-VbJlgvvQqt.flamegraph.svg
More readable: https://gist.github.com/manaka/34c15488d22bfab383bc9fcb1fd26820
I find out that parser update (3.0.2.0 → 3.0.3.2) is breaking working before 0.9.35
@manaka Please file an issue in https://github.com/whitequark/parser/
More readable: gist.github.com/manaka/34c15488d22bfab383bc9fcb1fd26820
I've edited your comment to use triple backticks instead of a single backtick and now it's readable here as well
I can confirm that downgrading parser
to 3.0.2.0
reduced my I18n::Tasks::MissingKeys
times from 210 seconds to only 10 seconds
Thank you @manaka! There was an issue regarding performance opened in the parser
repo two weeks ago. I mentioned the difference between the two versions there.
Fixed in parser
version 3.2.2.1, see https://github.com/whitequark/parser/pull/924