Hi, which V8 version are you using? I don't think you can hit that assertion with the code serializer with the most up-to-date V8. kProduceParserCache doesn't produce any cached code, just some hint to speed up parsing. In some cases there is no hint that the parser can take advantage of.
What you should instead use is the custom start-up snapshot. You would create a snapshot of the heap after you executed the startup script, so that later, starting up would already put the heap into the state you snapshotted. Here's a short explaination: http://www.hashseed.net/2015/03/improving-v8s-performance-using.html Yang On Friday, July 24, 2015 at 11:43:42 AM UTC+2, edhenolin wrote: > > I'm using node and v8 to run a relatively big program on an embedded > system. Studies indicate that compiling the user javascript code sometimes > take up to 3 seconds, which make for slow startup times of the javascript > application. > > Is there any way to speed this up? I have been trying to use > the ScriptCompiler::CachedData, producing this on first compilation and > then saving to disk. But I have been running into problems. > > 1) > If I use ScriptCompiler::kProduceCodeCache I often get problems when > serializing, with a failure in CodeSerializer::SerializeObject that I > don't understand: > > // The code-caches link to context-specific code objects, which// the startup > and context serializes cannot currently handle. > DCHECK(!heap_object->IsMap() || > Map::cast(heap_object)->code_cache() == > heap_object->GetHeap()->empty_fixed_array()); > > > Can anyone explain why I get this? I don't understand the comment. > > IF compilation and serializing succeeds I will get a CachedData that I try > to save to disk. On subsequent loads of the process it seems like I can't > use this saved Cache however. Does anyone know if this is because the > generated code has hardcoded memory addresses that will not work once the > process has been restarted? > > 2) > If I use CompileOptions::kProduceParserCache it seems to work just fine. > However I notice two problems. > > a) Some files will not produce any data in the cache. > > b) Those that do only generate 20 bytes of data, and loading this on > subsequent compilations doesn't seems to speed up compilation at all. > > Can anyone explain those two points? > > Any other ideas on how it would be possible to speed up the initial > loading of larger scripts? I assume we must be able to cache something, but > so far I haven't had much success. > > Thanks in advance. > > > > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
