Skip to content

Lag when changing to File/Tools tab on macOS #7924

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

Closed
45gfg9 opened this issue Aug 25, 2018 · 16 comments
Closed

Lag when changing to File/Tools tab on macOS #7924

45gfg9 opened this issue Aug 25, 2018 · 16 comments
Milestone

Comments

@45gfg9
Copy link
Contributor

45gfg9 commented Aug 25, 2018

OS: macOS 10.13.6
IDE: 1.8.6
When changing between tabs, File tab causes lag.
2018-08-25 23 09 17
When changing from other tabs to File tab, it will lag about a second.
Changing to Tools tab also causes lag, but it's much shorter, about 0.1 sec.
Other tabs Edit/Sketch/Help tabs work fine.

@MCUdude
Copy link

MCUdude commented Aug 26, 2018

I'm experiencing the exact same issues. I'm using MacOS 10.12.6

@PaulStoffregen
Copy link
Contributor

Random question - Are you using Teensy, or have you run the Teensyduino installer on this copy of Arduino 1.8.6? There may be a bug in Teensyduino which adds lag to some of the menus. I'm investigating...

Just want to confirm these are the Arduino IDE without Teensy's modifications. Wouldn't want to bother the Arduino devs with something that might be my fault.

@MCUdude
Copy link

MCUdude commented Aug 26, 2018

my menu is really laggy and slow without teensyduino installed. I ended up going back to 1.8.5 because it might take half a minute for the boards menu to respond. Instant spinning ball..

@45gfg9
Copy link
Contributor Author

45gfg9 commented Aug 27, 2018

Hiya, here to say I am not using Teensy.

@DrDiodac
Copy link

I have the same problem huge lags, slow down even restarting itself my Mac and after restart, kernel panic alert.
But if I not touch menu, I can working normally.

@facchinm
Copy link
Member

Bisecting right now, I'll notify you when I get something 😉

@facchinm
Copy link
Member

Found the culprit, it's Java (again) 😡
1.8.5 was bundled with JRE8u151 while 1.8.6 with u171 . Bisecting shows that the first problematic version is u161 but there's nothing in the release notes that catches the eye.

The slowdown exists even if I revert a2b5f66 and companion commits or compile IDE 1.8.4, so the bug lies somewhere else.

As a workaround while we investigate, I'd revert jre to u151 on nighlty builds (even if it's EOL) since it doesn't look like there are super important bugfixes between 151 and 181.

@facchinm
Copy link
Member

Profiling shows something interesting

JRE 8u161

  1690000000   41.02%      169  sun.lwawt.macosx.LWCToolkit.doAWTRunLoopImpl
   260000000    6.31%       26  sun.lwawt.macosx.CMenuItem.nativeSetLabel
   220000000    5.34%       22  sun.lwawt.macosx.CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse
   180000000    4.37%       18  sun.lwawt.macosx.CMenuItem.nativeCreate
    80000000    1.94%        8  java.lang.Object.wait
    80000000    1.94%        8  sun.lwawt.macosx.CFRetainedResource.nativeCFRelease

JRE 8u151

   390000000   30.47%       39  sun.lwawt.macosx.CPlatformWindow.nativeGetTopmostPlatformWindowUnderMouse
    40000000    3.13%        4  sun.misc.Unsafe.unpark
    20000000    1.56%        2  sun.java2d.opengl.OGLRenderQueue.flushBuffer
    20000000    1.56%        2  sun.java2d.opengl.CGLLayer.blitTexture
    10000000    0.78%        1  java.awt.KeyboardFocusManager.setGlobalCurrentFocusCycleRootPriv

If anyone's deeply into Java it would be nice to get some help to find the root cause and create a proper bug report

facchinm added a commit to facchinm/Arduino that referenced this issue Aug 27, 2018
Fixes arduino#7924

JRE 8u161 made JMenu.insert() MUCH slower on OSX.
This exposed a bug lurking there for years; in fact the menu entries were rebuilt every time since JMenu.getComponent() returns an empty list.
The correct function is JMenu.getMenuComponents().
In the meantime, also remove sketchbookMenu and examplesMenu being deleted on board change; only their content needs to be updated, not the container itself.
@facchinm
Copy link
Member

@DrDiodac @45gfg9 @MCUdude would you mind testing the build that is being produced by #7935 ? Thanks!

@facchinm facchinm added this to the Release 1.8.7 milestone Aug 27, 2018
@MCUdude
Copy link

MCUdude commented Aug 27, 2018

I just downloaded and tested it. Works fine for me now! 👍🏻

@DrDiodac
Copy link

DrDiodac commented Aug 27, 2018 via email

@per1234
Copy link
Collaborator

per1234 commented Aug 27, 2018

@DrDiodac

  1. Download http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-7935-BUILD-760-macosx.zip
  2. Use the downloaded test version of the Arduino IDE just as you would the production IDE release (more info)

Thanks!

@45gfg9
Copy link
Contributor Author

45gfg9 commented Aug 28, 2018

Thank you! Now it works as normal. No more lags. 🎉

@DrDiodac
Copy link

DrDiodac commented Aug 28, 2018 via email

@Vipas-ana
Copy link

#7935 Fixes this issue.

@45gfg9
Copy link
Contributor Author

45gfg9 commented Aug 28, 2018

Ok, so now I think I can close this issue. Thank you all!

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

No branches or pull requests

7 participants