Subj : Performance Advice on Maintaining Many Contexts To : netscape.public.mozilla.jseng From : peter.kyme Date : Wed Mar 02 2005 06:35 am My problem involves a system containing a large number (> 100) of objects, each of which has an associated Spidermonkey context. The objects execute a small javascript repeatedly, iterating until termination. This javascript is user defined, and so may contain arbitrary local variables, which was my motivation for creating a context per object (no multithreading is involved). This appears to work well, but I've encountered a nasty performance issue at cleanup time. Running the program through once, without doing any memory cleanup takes ~1.2s. If I then add code to destroy the JS contexts before exits, the program take ~17s to execute. Am I taking the wrong approach? Performance is quite important here, and I'm struggling to see how to proceed if I can't get around this. .