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

optimize memory usage #140

Closed
nhooyr opened this issue Mar 8, 2019 · 7 comments
Closed

optimize memory usage #140

nhooyr opened this issue Mar 8, 2019 · 7 comments

Comments

@nhooyr
Copy link
Contributor

nhooyr commented Mar 8, 2019

See #136

@kylecarbs
Copy link
Member

This will require a significant amount of refactoring in the way we fork processes. Will likely require a custom binary packaging system.

@sr229
Copy link
Contributor

sr229 commented Mar 18, 2019

a more likely patch as well is to tell V8 to go JITLess and use Ignition, which should tell the engine to no longer allocate a stack for compiling bytecode and instead use the interpreter. This approach has been seen to improve performance so I believe we can set this as well

@sr229
Copy link
Contributor

sr229 commented Apr 10, 2019

@kylecarbs So based on my testing and some further research, here's what I can suggest to make our consumption low

V8 by default in nbin should be JIT-Less

The problem with V8's way of dealing with JITed code takes a lot of memory - hence why it can't run on memory-limited environments properly. Google did a trick on V8 by going JIT-less. The way V8 does this is directly using the Ignition interpreter. This improved Chrome's performance in Mobile by around 20% according to V8's Blog.

Refactor the Forking process

It seems extension host contributes to most of code-server's memory. We should do optimizations on the forking process. It seems to fork too much which is considered not okay.

I suggest looking at Theia's extension manager to help with our patch.

Use Node-ChakraCore

This should be considered last resort. ChakraCore is known to work on mobile without much modification and overhead, hence its a good way to consider using ChakraCore. A version of node exists for this. The downside is on Raspberry Pi Zeros, Chakra won't be able to take advantage of its threaded implementation.

@kylecarbs
Copy link
Member

@sr229 how can we compile nbin to be JIT-less?

@sr229
Copy link
Contributor

sr229 commented Apr 25, 2019

@kylecarbs Refer to nodejs/node#26758

@sr229
Copy link
Contributor

sr229 commented Jun 22, 2019

Left some comments as well for possible flags to include for performance increase in #795

@sr229
Copy link
Contributor

sr229 commented Sep 12, 2019

We managed to fix this in GH-857 (158M init, 256M with 3-5 extensions) so I'm writing this off as fixed.

@sr229 sr229 closed this as completed Sep 12, 2019
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

3 participants