fkling / astexplorer

A web tool to explore the ASTs generated by various parsers.
https://astexplorer.net/
MIT License
6.14k stars 729 forks source link

Website freezes if Java Parser is selected with JSON view tab #706

Closed anuragkr22 closed 8 months ago

anuragkr22 commented 8 months ago

Describe the bug After selecting 'Java' as the parser, clicking on the 'JSON' tab view tab freezes the page for 5-10 seconds. After this an error message occurs showing 'the page isn't responding'. If the page does respond, it again freezes frequently while doing so. Sometimes error occurs like 'This page is having a problem'.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://astexplorer.net/'
  2. Click on 'Java'
  3. Click on 'JSON'
  4. The page freezes

Expected behavior The page should have worked normally without much interruptions and freezing.

Screenshots Screenshot 2024-01-06 195259 Screenshot 2024-01-06 195516

Browser (please complete the following information):

astexplorer settings:

Additional context Add any other context about the problem here.

Scipion commented 8 months ago

With enough memory (and patience) you can see that parsing the key _START_CHARSHINT contains hundreds of thousands of characters and it's accessible in several places, so stringifying it produces a hundreds of Megs string.

The stringify happens in a generic component so it doesn't seems trivial a patch here, cause it can affect other parses.