What is the most efficient way to clean up the global object between running fragments of JavaScript?
I am running a fragment of JavaScript in a tight loop to make a simple calculation for each of hundreds of thousands of inputs. I don't want variables set by one execution to bleed into the next. My first thought was to try to swap in a different global object for each v8 iteration, but I can find no mechanism to do that. (Earlier versions of v8 might have supported it via something like Context.ReattachGlobal() <https://groups.google.com/forum/#!msg/v8-users/FfqgU3jEKf4>, but that function no longer exists.) I can manually iterate over the global object and clean up after myself (as this guy does <https://groups.google.com/forum/#%21topic/v8-users/q2CDsy58Dcc>), but my JavaScript fragments are fairly simple and the cleanup dominates execution time (because v8 is so fast). I think recreating the Context each time will be even slower than this. particularly because I will need to repopulate it with various objects. Oliver -- -- 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.
