2.0 slows down if very long lines (but OK with CRs / Line feeds inserted)

I am using latest build 2.0 on Apple MacBook with M1 chip on Apple OS 12.3
Arduino Version: 2.0.0-rc9.1-nightly-20220810
Date: 2022-08-10T09:43:34.510Z
with a LILYG T-Display-S3 ESP32-S3

2.0 is working well and I am uploading to the ESP32 board. I am testing the sample test sketch from factory with an image stored as: const unsigned char img_logo[108800] =

This works well - but if I modify the image data (without line feeds to split up the long line). the 2.0 editor slows down massively. (It still compiles and uploads image to board - ie no issue with the sketch.)

The slow down is significant and the whole sketch is almost impossible to edit. If I remove my image file without the end of line carriage returns and go back to original file - (with carriage returns/line feeds after every 16 bytes) then editor becomes usable again. I know I could add lots of carriage returns but good if it didn't slow down everything if they missing?

Hi @andrewashe. Thanks for your report.

This bug is being tracked by the Arduino IDE developers here:

If you have a GitHub account, you can subscribe to that issue to get notifications of any new developments related to this subject.

Ah yes - I see - Its not quite the same bug (But maybe same cause) as my slow down caused by long lines in the sketch (not printing long lines to serial monitor)

Oops. I apologize. I didn't read it carefully.

Do you happen to know of an example of an existing real sketch out in the wild that could be used as a demo for a bug report to the developers?

I just did a survey of the sketches in the official Arduino libraries and didn't find any. I can reproduce the issue with a contrived sketch, but I think such a demo makes a less compelling argument for the need for Arduino to expend resources to investigating and fixing the issue.

I did find that Arduino IDE 1.x was able to handle even the ridiculous 789 KB sketch I produced.

I'll attach it here in case anyone is interested in such shenanigans.

LongLine.ino (782.1 KB)

Nixie.h (531.7 KB)
I have created an image Nixie.h (attached) that uploads and displays perfectly to Lilygo ESP32 display (320x170)
Unless I add lots of (not strictly needed) carriage returns - it slows down 2.0 . even editing other tabs . Hope this helps. Andrew (Hugely grateful to the team for the work on 2.0 Thank you.)

That definitely serves as a better demo than the unrealistic sketch I made. Did you use some program to generate that file?

Yes - I converted a 320 v 170 image for display using tft library using:

Very nice tool!

I have now submitted a formal report to the Arduino IDE developers:

It seems this is actually a bug in the free open source Eclipse Theia IDE framework the Arduino IDE 2.x is built on. However, I found a simple configuration adjustment that fixes it.

I propose that the default value of this configuration setting be adjusted in the Arduino IDE codebase to solve it for everyone, but you can make that adjustment now to get an immediate fix. I'll provide the instructions:

  1. Open the "Command Palette" via the Ctrl+Shift+P shortcut (Command+Shift+P for macOS users).
  2. Select the "Preferences: Open Settings (UI)" command from the "Command Palette".
    This will open the "Preferences" tab in the IDE.
  3. In the "Search Settings" field, type editor.maxTokenizationLineLength
  4. Change the value of the "Editor: Max Tokenization Line Length" setting from the default 20000 to 500
  5. Close the "Preferences" tab by clicking its X icon.
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.