On 21 May 2014 06:43, Si Robertson <retromodu...@gmail.com> wrote: > Let's say someone has quite a large amount of code, possibly for a game or > application, and they wrapped all of that code in a closure ... > > (function(){ > // all code goes here > })() > > Would that cause any problems with V8 as far as optimisation and/or garbage > collection is concerned?
If it is the closure environment you are worrying about, then this will be empty (assuming this expression occurs on the toplevel). A closure only closes over lexical or local variables, and (before ES6) the toplevel has neither. Generated code might actually be better, because all outermost variables of 'code' become local instead of polluting the global object, which should be more efficient in both time and space. /Andreas -- -- v8-users mailing list v8-users@googlegroups.com 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 v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.