Is it possible to detect that a Firefox browser is running the TraceMonkey JavaScript interpreter? If so, is it possible to do it with JavaScript? A solution which involves examining the browser binary or shared libraries is also OK for me. I'm running Linux with Firefox 3.0.14 right now.
Asked
Active
Viewed 420 times
0
-
4What are you trying to achieve overall? – meder omuraliev Oct 04 '09 at 18:32
-
I want to benchmark my JavaScript code, and for that I want to know if the browser is running TraceMonkey. It seems to me that my number-crunching JavaScript runs at about the same speed on Firefox 3.0.14 and Firefox 3.5.2, the latter being just 10% faster. I hesitate to believe this, because TraceMonkey should be much faster. – pts Oct 04 '09 at 19:19
-
I believe the primary benefit of TraceMonkey would be in providing efficiencies in such areas as control flow; if your code is indeed "number-crunching" then there wouldn't be any good reason to expect a massive improvement, as all the number-crunching is already being done in native code. If, for example, you are iterating over the elements of an array and applying a calculation to them, the overhead of the iteration would be reduced, but the actual calculations would still be carried out by the same native-code routines as before and would show no improvement. – NickFitz Oct 05 '09 at 02:31
-
My general experience with scripting languages is that it is never the actual numerical operations are slow, but others such as incrementing the index variable, calling a function, jumping in a loop, doing garbage collection. That's because the interpreter is slow. So the less code I write, the faster it becomes, even if I use double instead of int for all numbers etc. So I would expect that my number-crunching script (which generates arrays and has some recursive function calls) benefits from JIT and TraceMonkey. But it doesn't. – pts Oct 05 '09 at 07:06
2 Answers
3
- enter "about:config" as URL
- say you will be careful
- search "JIT"
you can check if it's enabled by looking at:
javascript.options.jit.chrome -> for browser UI and plugins
javascript.options.jit.content -> for web content
(you can also change the values)
btw. if your code is a little complex don't expect to get a speed comparable to V8. Tracemonkey fails with branchy code (it may be slower than spidermonkey).
More info: http://hacks.mozilla.org/2009/07/tracemonkey-overview/

Peter
- 5,138
- 5
- 29
- 38
-
Thanks for the helpful answer. Only Firefox 3.5 has those JIT options, Firefox 3.0.14 doesn't have them. (It is enabled for content only.) Nevertheless, it doesn't make any difference for my JavaScript code either to turn JIT off in Firefox 3.5.2. – pts Oct 04 '09 at 21:22
-
Tracemonkey is only available for FF versions 3.5 and higher. But on dev versions 3.6 and 3.7 it's still very useless for not-to-complex code. Try to keep your loops as simple as possible to get the JIT benefits. – Peter Oct 05 '09 at 19:56
0
So, 3.0 doesn't have tracemonkey, and regarding your comment that in 3.5 it doesn't work either - are you maybe running distro-provided 64-bit? I recall reading that tracemonkey was disabled on 64-bit builds (the support was implemented only recently and is not in Firefox 3.5).

Nickolay
- 31,095
- 13
- 107
- 185