Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
- 4.2.5 (I've been able to reproduce on 4.1.0 and 4.0.0 as well).
- Operating System:
- macOS 10.14.5
- Last Known Working Electron version:
- 3.1.11, 5.0.6 works well as well.
Expected Behavior
The time it takes to execute remote.getCurrentWindow() should be consistent and not increase by 100X under some situations.
Actual Behavior
On Electron v4, under some situations, calling remote.getCurrentWindow() from the renderer process takes way longer than normally, causing unresponsiveness on the UI.
We've been able to reproduce this when the window gets resized at the same time that remote.getCurrentWindow() is called. In these situations, that method can take up to 170ms compared to ~0.4ms that it normally takes.
To Reproduce
The minimal repro steps to reproduce this issue is to add this commit: rafeca/electron-quick-start@a8b4dfd on electron-quick-start repository.
You can repro with the following steps:
$ git clone [email protected]:rafeca/electron-quick-start.git -b slow-getcurrent-window
$ npm install
$ npm start.Then, open the devtools, start a JavaScript profiler do a few windows resizes.
Screenshots
These are the screenshots of profile sessions with the above code, while resizing the electron window.
Electron v3: the time to get the current window is consistently ~1ms ✅
Electron v5: the time to get the current window is consistently ~1ms ✅
Electron v4: the time to get the current window sometimes increases by ~170X to around ~170ms, blocking the UI ❌
Additional Information
This behaviour is way more accentuated on a real application (like the Atom Editor, where the time to call getCurrentWindow() on Electron v4 can grow to up to 5 seconds).
While I understand that calling remote.getCurrentWindow() should be discouraged since it's doing synchronous IPC communication, I think that this issue is still worth considering since:
remote.getCurrentWindow()is an official electron API method, with no easy to use async alternatives and no warnings about its performance in the docs.- This regression only affects Electron v4 and got fixed somehow in v5, so maybe it's easy to identify what fixed it on v5 and cherry pick that fix to v4.



Activity
miniak commentedon Oct 27, 2019
Electron 4 is not supported anymore.
https://electronjs.org/blog/electron-7-0#end-of-support-for-4xy