This will require a significant amount of refactoring in the way we fork processes. Will likely require a custom binary packaging system.
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
@kylecarbs So based on my testing and some further research, here's what I can suggest to make our consumption low
nbin should be JIT-LessThe 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.
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.
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.
@sr229 how can we compile nbin to be JIT-less?
@kylecarbs Refer to nodejs/node#26758
Left some comments as well for possible flags to include for performance increase in #795
We managed to fix this in GH-857 (158M init, 256M with 3-5 extensions) so I'm writing this off as fixed.
Most helpful comment
@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
nbinshould be JIT-LessThe 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.