Hi all,The CCF project (https://github.com/microsoft/CCF) is evaluating to use V8 as JavaScript engine (currently QuickJS) for handling HTTP requests.One of the requirements we have is that each request should get a fresh environment. In QuickJS, we simply create a new runtime for each request as it is very cheap. In V8 we re-use isolates but create a new context for each request. Is my understanding correct that using a new context is the only way to get an untouched JavaScript environment each time?
Some early performance tests indicate that we spend most of the time in creating new contexts. Looking at profiling data it seems that each time the (default) snapshot is decompressed and deserialized, and probably other initializations are done after that. It seems that decompressing and deserialization should only be done once and after that a memcpy would be enough?Is there something obvious I'm missing?
Sorry for the late response, for some reason this ended up in spam...
You can turn off snapshot compression to see if that makes a difference. Add v8_enable_snapshot_compression = false to your GN args.
Disabling snapshot compression helped a bit. As a test, I also disabled string rehashing. Now most of the overhead is deserialization. I attached a flamegraph, maybe that gives some insight.