Main menu:

Site search

Categories

Archive

JägerMonkey: the “halfway” point

JägerMonkey has reached a halfway point: we’ve closed about half the performance gap between our baseline performance (with no tracing) and the competition. You can see this on arewefastyet.com, a site David Anderson created to track our progress. Thanks also to the anonymous contributor who gave us an improved page design.

So far. That improvement represents about 6-8 weeks of work. Major performance improvements we did during that time:

  • Polymorphic inline caching (PICs) for object property access. We actually had a pretty good system for optimizing properties before, the property cache. But the property cache requires calls to C++ functions, taking us off the super-fast native jit code. PICs are similar to the property cache, but are more amenable to jit code.
  • More compiler “fast paths”. There are two basic ways to implement an operation in a compiler like JM: either calling out to a C++ “stub function”, or inline with the jit code in a “fast path”. We added fast paths for more operations, so we can potentially run about 80% of the operations in the SunSpider/v8 benchmarks in pure jit code. (We’re aiming for 95-99%.)
  • Register allocation and local optimizations. We’ve enhanced the compiler so that it uses machine registers more efficiently, trying to hold values in registers and reuse them instead of always loading from and storing to memory.
  • Improving global variables. This one is still in progress, but we’ve already posted some perf wins from it. We’re completely overhauling the way global variable accesses are resolved and compiled to make them the fastest they can be in a JM-style system.

I want to add that we’ve referred to JSC (WebKit’s JS engine) and V8 frequently. We’ve been striving to build on what’s been figured out already rather than rediscovering everything. In particular, we took a lot of the design ideas for PICs and globals from JSC, and some more design ideas for PICs and the concept for register allocation from V8. So, credit and thanks to the JSC and V8 teams and their open source efforts.

Next. We have a ton of work left to do, and it’s not easily summarized, so I’ll just mention some highlights.

The biggest ongoing piece of work is our new JavaScript value representation. In the old interpreter, a value is represented by a machine word with 1-3 tag bits and 29-31 bits (on a 32-bit machine) of value payload. The biggest cost of this scheme is that because floating point numbers require 64 bits, so they don’t fit. Instead, floating point numbers are stored on the heap, and the tagged value contains a pointer. This makes creating, reading, writing, and cleaning up floating-point values much more expensive.

The new values are planned to be 128 bits, with a full 64-bit payload. Thus, floating-point numbers can be stored directly in the value. Also, the tag bits are off to the side so they don’t have to be added or removed with bit operations.

Strings and regular expressions are also scheduled to get some attention soon.

Finally, we are going to teach the debug API (behind Firebug and Venkman) to debug compiled JavaScript. So, with JägerMonkey, it will be possible to run a debugger but still run JS fast.

Final thought. The other big piece of work starting now is to get JägerMonkey to work inside the browser. You can build a browser with JM today, but you probably won’t get too far before crashing. Fixing that is next on my list.

Comments

Pingback from David Mandelin's blog » JägerMonkey: the “halfway” point Type
Time: May 10, 2010, 3:02 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point From Point of Inquiry: Are First and Second Generation Atheists …Summer Jazz Series @ Point Breeze's Concert Garden | Things to Do …Center Point High School groundbreaking set | al.comBBC – Nick Bryant's Australia: The Tipping PointWin It! $100 Gift Card to The Cheesecake Factory | ExtraWatch Nick Clegg on the BBC Politics Show tomorrow« The Real Hustle (UK) – Casino Chip Steal | Online GamblingLady Gaga Dance Battles – Check Out the Fabulous Sydney Harbor …P.M.KEN Photo Exhibition : “Cross Point” | VERBAL's Blog | HypebeastClassic Game Room HD – CALL OF DUTY 2 review Xbox 360 | All Info … View the Contact Powered by Type [...]

Pingback from Tweets that mention David Mandelin’s blog » JägerMonkey: the “halfway” point — Topsy.com
Time: May 10, 2010, 3:40 pm

[...] This post was mentioned on Twitter by Deb Richardson, Planet Repeater. Planet Repeater said: David Mandelin: JägerMonkey: the “halfway” point http://dlvr.it/vBmf [...]

Comment from Harsh
Time: May 10, 2010, 5:50 pm

Maybe a stupid question but, Is “Register allocation and local optimizations” the same as a Register-based bytecode?

Comment from Boris
Time: May 10, 2010, 7:46 pm

Harsh, not quite. The bytecode is still a stack machine, but the register allocator in JM does some optimization to avoid writing back to the stack on every op.

Comment from bastiaan
Time: May 11, 2010, 12:56 am

“JägerMonkey has reached a halfway point: we’ve closed about half the performance gap between our baseline performance (with no tracing) and the competition.”

It is probably worth mentioning that this competition includes SpiderMonkey’s (tracing) JIT mode.

Pingback from colonial singapore travel – Jordan Kowalski | Singapore Traveling
Time: May 11, 2010, 2:02 am

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Comment from nominolo
Time: May 11, 2010, 3:51 am

Did you consider using NaN-tagging instead of fat values? NaN-tagging is successfully being used by LuaJIT 2 and is able to represent all objects in 64bits (including Doubles). The idea is to use redundancies in the floating point representation and make tagged values look like NaNs. I’m not sure how portable this is, though. I suppose the main limitation is that tagged values cannot be 64 bit wide (e.g., pointers), which puts some constraints on the memory allocator.

On a different note, according to one of the papers on TraceMonkey, traces get aborted on memory allocation. The reasoning was that allocation was very expensive. This may be true for non-moving garbage collectors, but most modern GCs support simple bump-allocation — allocation simply means incrementing the heap pointer by the requested size. Has anything changed in that area?

Comment from Edward Kmett
Time: May 11, 2010, 4:16 am

@nominolo: actually you can fit a pointer in just fine: set the 12 msbs to 1 and store the pointer in that ’1-extended form’ supported by x86-64 rather than 0-extended. I’ve tagged pointers, ints, floats, and a dozen other primitive value-types using this technique just fine.

In general I agree, NaN-tagged values work a heck of a lot better for cache-locality, etc. than 128 bit wide values.

Comment from bharuch
Time: May 11, 2010, 5:51 am

I’m not sure I’m reading are we fast yet correctly. The JIT + Jaeger mode still seems approximately same (moz method + tracing line), and has not closed the gap with v8 / SS on desktop (ARM shows nice improvements). When will the jaeger monkey work improve the total JS performance vis-a-vis V8/apple on SS or V8. It seems I’m missing a few piece in understanding the big picture of this work.

Pingback from eCom Online Marketing : Media Center, Press & Official Blog » Blog Archive » Firefox 4 release plan: the need for speed
Time: May 11, 2010, 6:02 am

[...] about half the performance gap between our baseline performance and the competition,” said JaegerMonkey programmer David Mandelin in a blog post Monday. However, he added, “You can build a browser with JM [JägerMonkey] [...]

Comment from bystander
Time: May 11, 2010, 7:41 am

@EdwardKmett

Can you elaborate on which ’1-extended form’ you are referring to with pointers encoded with 12 most significant bits set to 1?

Pingback from Do credit card numbers get recycled later on after being reported lost, stolen, or canceled? | Personal injury lawyer
Time: May 11, 2010, 8:35 am

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Comment from David Anderson
Time: May 11, 2010, 10:27 am

nominolo: I’m not sure what you mean. Traces don’t get aborted on memory allocation, though they do get aborted on out-of-memory (we cannot GC while on trace yet, bug 516832 will help).

re: value tagging, we did quite a bit of measurement here and found that the important thing was not boxing doubles. Luke could give more detail, I recommend seeing the bug (549143) and a preceding one with synthetic measurements (539123).

Comment from dmandelin
Time: May 11, 2010, 12:50 pm

@nominolo: We did some pilot studies on different value formats, including NaN-boxing. We didn’t see big differences between NaN-boxing and 128-bit values. 128-bit values seemed to make it faster to enter and exit traces, which we figured would help JM work together with tracing better.

@bharuch: We don’t yet know why Trace+Jaeger isn’t faster than just Trace. For now, we’re focused on getting JM as good as it can be. After that, we can see what Trace+Jaeger does and retune how tracing is activated to try make it better.

Pingback from 8. How did bad tax policy contribute to the financial meltdown? | equity loans
Time: May 11, 2010, 2:11 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Comment from nominolo
Time: May 11, 2010, 3:19 pm

@David Anderson

Ah, sorry, I confused that with another paper by Andreas Gal. (“Incremental Dynamic Code Generation with Trace Trees”, TR, 2006)

Pingback from Toshiba Tec and Intersport get Champions League Final Payday | FIFA World Cup
Time: May 11, 2010, 4:36 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Pingback from SMASH Summit: NXS at social marketing event : northxsouth : free … | ProBlogr
Time: May 12, 2010, 1:30 am

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Pingback from In the news: Sam Querrey wins rare American duel | FIFA World Cup
Time: May 12, 2010, 2:58 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Pingback from Should Australia and the Socceroos host the world cup in 2018? | FIFA World Cup
Time: May 12, 2010, 5:05 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Pingback from If there is a total of 12 players from the Paraguayan National team playing in Mexico! | FIFA World Cup
Time: May 12, 2010, 9:55 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Pingback from Make Money- How often to paid survey sites send out surveys?-Increase Profits Online
Time: May 15, 2010, 10:52 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Pingback from 30 Days of Beauty Freebies Alert: Win a Bottle of Davines Shampoo … | Freebies Uncovered
Time: May 27, 2010, 1:15 pm

[...] David Mandelin's blog » JägerMonkey: the “halfway” point [...]

Comment from Viagra Vs Cialis
Time: June 12, 2010, 5:30 pm

Interesting reading old posts and seeing the problems posting in the browser.

Comment from McBurrz
Time: June 14, 2010, 4:17 pm

Excellent to see the progress you are making! Keep up the hard work, looking forward to hearing more updates!

Comment from Fathers Day Presents
Time: June 19, 2010, 12:36 am

This was a very interesting blog and It made me laugh for a bit. Looking forward to another one with more ideas to share!

Comment from Josh
Time: July 1, 2010, 3:18 am

The other big piece of work starting now is to get JägerMonkey to work inside the browser. You can build a browser with JM today, but you probably won’t get too far before crashing. Fixing that is next on my list.
Can’t wait to see a fix for this!

Comment from denissa
Time: July 4, 2010, 3:21 am

JägerMonkey is good written…i like him

email extractor

Comment from Sesli Goruntulu Chat
Time: July 6, 2010, 2:00 pm

guzel is cikartmissiniz devam edin bole .

Comment from srmsofttech15
Time: July 11, 2010, 9:55 pm

Earn global money shows you different earning programs from all over the globe and help people to earnmoney from different click here

Comment from online vegas casino guide
Time: July 12, 2010, 7:05 am

You’re doing really well, man!
Do love you style of writing!

Comment from Paul
Time: July 12, 2010, 8:43 am

David,
Would be great to see another update soon! What is implemented, what remains, and what gains have been seen so far and are expected to be realized going forward….
Thank you for your great work on the Jaeger project!

Pingback from JägerMonkey has Crossed the Streams » Mystery Bail Theater
Time: July 13, 2010, 9:37 pm

[...] early May, Dave Mandelin blogged about our half-way point. Around the same time, Luke Wagner finished the brunt of a massive overhaul of our value [...]

Comment from srmsoft16
Time: July 13, 2010, 11:30 pm

EARN GLOBAL MONEY shows you different earning programs from all over the globe and help people to earn money from different earning program owned by different organizations.
Click Here

Comment from Foreclosure Listings
Time: July 18, 2010, 11:07 am

Would love to see another update as well. Especially as regards progress on getting JägerMonkey working within a browser. Exciting stuff.

Comment from srmsofttech7
Time: July 23, 2010, 1:08 am

Would you like to become a bigger, better, stronger or more successful online income affiliate? If your answer is yes, then
Click Here

Pingback from Fun With Fast JavaScript ✩ Mozilla Hacks – the Web developer blog
Time: August 2, 2010, 11:07 am

[...] full method-based JIT for Firefox 4 (for more details, see David Anderson’s blog, as well as David Mandelin’s blog). This will provide significantly faster baseline JS performance, with the trace JIT becoming a [...]

Comment from printed folders
Time: August 13, 2010, 1:42 am

goog one

Comment from angilina
Time: August 16, 2010, 11:14 pm

Earning money online never been this easy and transparent. You would find great tips on how to make that dream amount every month. So go ahead and click here for more details and open floodgates to your online income. All the best.

Comment from ChexSystems
Time: August 21, 2010, 2:11 pm

David,

Could you update us on this – at least those of us here to actually read your blog?

Comment from jenelia jone
Time: August 31, 2010, 9:14 pm

EARN GLOBAL MONEY gives you instant access to a dynamic, scalable, dedicated and responsible development program – a committed to meeting the highest standards, committed to delivering on promises, and committed to ensuring every program success. click here

Comment from eurosportbet
Time: September 1, 2010, 1:02 am

i think a nice blog

Comment from edinburgh photographer
Time: September 4, 2010, 6:41 am

If perhaps a person can be hunting pertaining to the latest you actually should take into account choosing some through some sort of internet save. We tend to would suggest that experts claim somebody along with give some thought to buying effort interested in growing into nice. Your most common is actually without a doubt the idea may be the actual optimum manner in which to help go downward. The public may easily study as an individual are generally together with experience participating in the idea.

Comment from pele
Time: September 6, 2010, 3:03 am

Get Genuine Ways To Earn Money Online With Payment Proofs. You Can Learn How To Make Money With Traffic Improvement Tips and make $100 every day .So That You Don’t Waste Your Time And Money. click here

Comment from StreetShadows
Time: September 23, 2010, 3:19 pm

Great post, good to see some real progress here, well done

Comment from Oto Kiralama
Time: October 6, 2010, 7:50 am

Interesting reading old posts and seeing the problems posting in the browser…

Comment from sohbet siteleri
Time: October 9, 2010, 7:05 am

This was a very interesting blog and It made me laugh for a bit. Looking forward to another one with more ideas to share!

Comment from web tasarım
Time: October 11, 2010, 9:11 am

Thank you admin good article

Comment from otels
Time: October 17, 2010, 11:11 pm

thank you for sharing

Comment from Money Attraction
Time: November 10, 2010, 8:50 pm

Making good progress. Still don’t understand much of what you are doing, but thanks for the updates.