electron-spellchecker icon indicating copy to clipboard operation
electron-spellchecker copied to clipboard

Performance Issues

Open ccorcos opened this issue 7 years ago • 5 comments

I'm having issues where the spellchecker takes up huge frames.

I'm Mac Sierra btw.

image

ccorcos avatar Oct 09 '17 21:10 ccorcos

If I spam on my application ( you can find it at www.notion.so/desktop ), you'll see that the spellchecker runs every time I press space.

However in Atom, it doesn't run the spell checked until I stop typing:

ccorcos avatar Oct 09 '17 21:10 ccorcos

I filed an issue with Electron because I think it might be on their end: https://github.com/electron/electron/issues/10734

ccorcos avatar Oct 09 '17 22:10 ccorcos

tbh, the core issue is that Electron's spellchecker API is a synchronous API - we must immediately return a response, and especially on macOS, NSSpellchecker sometimes randomly decides to be very slow. Making the spellchecker API async would make solving this issue much easier.

anaisbetts avatar Oct 10 '17 00:10 anaisbetts

So this is much faster on an older version of the app:

image

When Xcode developer tools upgraded with macOS High Sierra, I had to upgrade everything in order for the build to work and now its way slower... Perhaps some bindings broke and isn't able to use the native spellchecker anymore...?

ccorcos avatar Oct 17 '17 17:10 ccorcos

Is the synchronized API electron specific or imposed by Chromium? Reason I'm asking is that in WebKit's WebSpellCheckClient definition, there's a requestCheckingOfText which seems to be async. But maybe it's just we can't run js in chrome's worker thread?

Edit: I see that in the impl for this requestCheckingOfText API in electron, we are synchronously calling into V8 to call our spellchecker provider's method. And it's difficult to run it on worker thread because main thread has exclusive access to v8.

zhenchaoli avatar Jan 02 '18 19:01 zhenchaoli