Skip to content
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

Slow operations over NAPI #138467

Closed
ncannasse opened this issue Dec 5, 2021 · 5 comments
Closed

Slow operations over NAPI #138467

ncannasse opened this issue Dec 5, 2021 · 5 comments
Assignees
Labels
electron Issues and items related to Electron extension-host Extension host issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@ncannasse
Copy link

Hi !

I'm the main developer of the Hashlink Debugger (https://github.com/vshaxe/hashlink-debugger)
We have noticed after upgrading from VSCode 1.55 to 1.56 that there was an important slowdown of the debugger.

I now took time to investigate it further, and found that the issue was related to a single call being made through ffi-napi to read the process memory (on windows ReadProcessMemory - https://github.com/vshaxe/hashlink-debugger/blob/master/hld/NodeDebugApi.hx#L46). Every call now takes tens to hundreds of milliseconds to complete which was not the case in VSCode 1.55

I thought first it was a performance regression in libffi so I upgraded to use another ffi library which claims superior speed (sbffi : https://github.com/bengl/sbffi), but the results are again good on 1.55 but very slow on latest 1.62.3, which leads me to think there is something in either VSCode or Electron that has been changed regarding NAPI implementation which makes ffi usage a magnitude slower than it used to be, making the debugger not very usable anymore.

Any insight to solve this quite technical issue would be greatly appreciated.

@gjsjohnmurray
Copy link
Contributor

Looks like 1.56 was when Electron 12 landed.

https://code.visualstudio.com/updates/v1_56#_electron-12-update

@weinand weinand removed their assignment Dec 6, 2021
@deepak1556
Copy link
Contributor

This would be a side-effect of electron/electron#28957 that requires nodejs/node@7abc7e4. Can you check if the issue is present with exploration builds based on newer runtime #137241 that contains the above fixes.

macOS universal
windows x64 user setup

@deepak1556 deepak1556 added electron Issues and items related to Electron extension-host Extension host issues info-needed Issue requires more information from poster upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Dec 6, 2021
@ncannasse
Copy link
Author

ncannasse commented Dec 6, 2021

I tried the exploration build but it still has the same behavior.

This can be reproduced by installing Haxe extension as well as Hashlink debugger, then creating a new project with these files :
testproject.zip

Put a breakpoint on Main.hx line 37 and compile & run. When the debugger breaks, try to display the content of o.m (a map with 200 elements). Notice a long loading time due to calls to ReadProcessMemory. Reproduced on Windows 10.

@ncannasse
Copy link
Author

@deepak1556 I think I have provided all the info required, any further insight ?

@deepak1556 deepak1556 removed the info-needed Issue requires more information from poster label Feb 1, 2022
@ncannasse
Copy link
Author

The issue has been reproduced and we found this is due to the new array buffer backing storage query in v8.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
electron Issues and items related to Electron extension-host Extension host issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants