Subj : multithread question To : netscape.public.mozilla.jseng From : Kumar Iyengar Date : Tue May 11 2004 05:25 pm I am in the process of evaluating Spidermonkey and have written a prototype that embeds Spidermonkey in our application. I have followed the rules(as far as i can tell) of multithreadedness as Spidermonkey recommends: *) Compile the library with JS_THREADSAFE, *) link with the libnspr4.lib file *) In code call BeginRequest and EndRequest in all places where there might be a potential block. Also, i have gone with the model currently where i have a Runtime for each thread. I know i can go with one Runtime but i have chosen this just for now. I have a script that adds 2 numbers. To get the numbers it makes a native call and another native call to set the result of the addition. In both the native calls, the work is done between the BeginRequest and EndRequest. When i run the test with one thread the numbers look good. However when i run the test with 5 users( i.e. 5 threads) the numbers come out 20 times slower!. With 5 threads I would have expected a worst case of max 5 times slower. Can anyone explain if there are other things to be aware of. Is there a lot of mutexing in either the js32.dll or libnspr4.lib that causes this? --kumar iyengar .