Eval itself is expensive in V8 because it has to compile the code and run once, then throw it away.
V8 added CompilationCache recently, it might help. If the same source code is eval'ed more than once, the second time pays no compilation cost if the cache is hit. I don't remember when the cache entry is evicted, check the source code. On Mon, Sep 29, 2008 at 7:29 AM, MalteU <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a questions relating to the performace impact of using eval. We > will of course benchmark this, too, but of course benchmark sometimes > lie. > > For the JS meta system Joose http://code.google.com/p/joose-js/ we are > evaluating changing the attribute meta class in way that getter and > setter methods for attributes are created using eval instead of > closures. Those uses of eval will almost always happen at "compile > time". > Initial benchmarking show that using eval improves runtime performance > by about 20-50% depending on the JS engine. > > Are there reasons (e.g. slower compilation of JS) against using eval > for this use case? > > Cheers > Malte > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
