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

Painfully slow in rspec with version 0.9.36 #407

Closed
manaka opened this issue Dec 22, 2021 · 7 comments · Fixed by #506
Closed

Painfully slow in rspec with version 0.9.36 #407

manaka opened this issue Dec 22, 2021 · 7 comments · Fixed by #506

Comments

@manaka
Copy link

manaka commented Dec 22, 2021

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?

@glebm
Copy link
Owner

glebm commented Dec 22, 2021

You can run i18n-tasks under a profiler, such as rbspy or ruby-prof, to identify where it is spending all this time

@glebm
Copy link
Owner

glebm commented Dec 22, 2021

Install rbspy per these instructions https://rbspy.github.io/

Then, run:

rbspy record bundle exec i18n-tasks health

@manaka
Copy link
Author

manaka commented Dec 22, 2021

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

@manaka
Copy link
Author

manaka commented Dec 27, 2021

I find out that parser update (3.0.2.0 → 3.0.3.2) is breaking working before 0.9.35

@glebm
Copy link
Owner

glebm commented Jan 5, 2022

@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

@levidavidmurray
Copy link

levidavidmurray commented Apr 6, 2023

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.

@glebm
Copy link
Owner

glebm commented Apr 25, 2023

Fixed in parser version 3.2.2.1, see whitequark/parser#924

glebm added a commit that referenced this issue Apr 25, 2023
This is the first version which includes the fix (whitequark/parser#924) to a performance issue (whitequark/parser#918) first introduced in 3.0.3.0 (whitequark/parser@547d731)

Fixes #407
glebm added a commit that referenced this issue Apr 25, 2023
This is the first version which includes the fix (whitequark/parser#924) to a performance issue (whitequark/parser#918) first introduced in 3.0.3.0 (whitequark/parser@547d731)

Fixes #407
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 a pull request may close this issue.

3 participants