Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JIT of JS code: performance of loop inlining

20 views
Skip to first unread message

Max Limper

unread,
Jul 17, 2012, 4:15:42 AM7/17/12
to dev-tree-manage...@lists.mozilla.org
Hi everybody,
sorry for cross-posting this issue, but after 4 days I got not a single
response on dev-tech-js-engine on this, so maybe someone here can help me:

I'm writing a js application with high demands on performance. Currently,
the heavy-weight task is executed inside a web worker. I realized that I
get a speedup of almost 10x if I simply make the loop execute only once by
modifiying the initial value of the increment 'j'.
Also, the full loop executes much faster (~6x) if I inline it's content
'by hand', i.e. I copy-/paste it 2 times.

However, this behaviour changes if I execute the same code in the main
context (instead of the worker), here even 'inlining' stuff by hand has no
visible effect on performance.

Does anybody have an explanation for this? I'm looking for a way to
understand what's going on inside Firefox' js interpreter / JIT-compiler
in order to be able to optimize my code... any help is appreciated. Thanks
a lot in advance!

0 new messages