intellij-plugin-v4: UI freeze after parse on SQL grammars with large inputs

I’m trying to profile my SQL grammar on a large input with diverse statements, which used to go fine in previous versions some years ago. I managed to consistently reproduce a UI freeze that seems to happen after parsing of the input is finished. Looking at the CPU load, there’s a ~15s multithreaded parser spike and then a single thread becomes pinned at 100% and UI freezes. Considering this and #381 it seems that the issue is with displaying parsing/profiling results. And it happens even when disabling every option on the left of the preview panel (auto-update, parse-tree etc).

Repro: Use example PostgreSQL grammar or my PostgreSQL grammar. Test root rule (sql rule in my grammar). Concat every example SQL into a single file, i used this command: find *.sql | xargs -I{} sh -c "cat {}; echo ''" > _concat.sql. Use the new, ~2.9MB file as ANTLR Preview input. Note UI freeze after a short delay (parse stage). UI doesn’t unfreeze for at least 10 minutes, process has to be killed.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks, works as expected now!

Holy crap! It looks like it’s the token view text field, which has, maybe, 800k lines given 76k input lines of SQL. @bjansen it’s TokenStreamViewer I think. If I comment that out, it takes all 76k SQL lines. A bit sluggish but works, even in intel emulation mode for M1 mac.

  1. Do we need this view when we can use ctrl+mouse hover to get token info? Looks like it was added here https://github.com/antlr/intellij-plugin-v4/issues/417 but I’m not sure it’s needed. Screen Shot 2022-05-08 at 8 19 29 PM

  2. If so, maybe we just need a limit to, say, 5000 tokens?

  3. If so, maybe we use a text box rather than JBList?

Also, I don’t think selecting the token in that view does anything but I see addParsingResultSelectionListener() so maybe we have a bug?

I think I’d vote for removing the view.