javascript in 2011

15 May 2011 5:53 PM (javascript | compilers | profiling | igalia)

Good evening tubes,

This hacklog needs an update, and how! I meant to write some stuff about Guile, which recently got some pretty great performance improvements, but instead bits on JavaScript were what trickled out of my fingers onto this Emacs. So here we go!

kung fu

I took a fairly deep dive into the world of JavaScript implementations recently, and man, what a world: a rotated-double-space punboxed jaeger-lithium crankshafted nitro-assembling trace stack of bit-froth. Yow! Now that's a fat value!

That probably makes no sense, right, but you have to understand that I've been jacked into this matrix for like three weeks now, and they speak a different language out there. If I were to draw some preliminary conclusions about the state of the art in JavaScript implementations, they would be these:

  • Trace looked fun, but it seems that it's possible to get trace-level performance with more traditional compilation techniques. (The trick appears to be to treat tagging, untagging and type checks as nodes in your control-flow graph.) V8 already has an SSA-based intermediate language, JavaScriptCore (the WebKit JavaScript implementation) is moving to one, and the above bug is from the Mozilla folk.

  • As a correlary to the previous point, data representation matters. It seems to me that JavaScriptCore's solid improvements have all been centered on cleanliness: keeping it simple, direct, and clean leads to speed. Right now JSC is trailing the pack again, but with a good SSA compiler, they could reach V8 again. Inner loops are important, but that's not where big applications spend most of their time.

  • The JS benchmarks are terrible, but everyone is using them to optimize their implementations. There's a serious danger of garbage-in, garbage-out here.

    To my eye the V8 ones are the best general-purpose benchmarks: the ones that represent not just the inner loops, but bigger programs. But hey, maybe that's just the Schemer in me amused at seeing cross-compiled Lisp benchmarks in their suite.

  • Tool support is terrible.

    All of these projects have to implement their own profilers, disassemblers, debuggers, etc, and for all platforms, in theory. In practice, yuck. GDB just got support for JIT-generated code, and it's terrible: you have to generate whole object files (ELF on ELF architectures, presumably mach-O or whatever on Darwin, and who knows on windows!), and if you want debugging information, you have to generate DWARF.

    Of course oprofile couldn't use the same format, it has its own thing, and it's not the same as the lovely but ungooglable perf, which appears to only support map files generated by some JVM no one has heard of, but has no support for garbage-collecting executable code or for line numbers. Aaargh!!!

    Incidentally, my colleague Xan appears to have run into these issues independently.

I've been joking recently that I've been coming up like Neo, in the training sequence, eyes open, drawn breath: "whoa: I know kung-funun-boxing."

All in all JavaScript in mid-2011 is looking much better than JavaScript in mid-2010 -- humbling, even -- and I look forward to hacking more on it. Actually, simply "hacking on it", as I have been taking uncomfortably long to get up to speed on things. (No one has yet said "Really? Show me." Ha ha.)

I suspect that tools is where I'll start. It sure would be nice to have line-level profiling interleaved with disassembly for JavaScript, somehow. (I hope it would be perf, but they seem an opinionated bunch. I hope you don't have to be Peter Zijlstra to get something into it.)

forward-looking statements

I try not to make promises about the future, so consider it simply a prediction, that the next entry will feature more parentheses than this one. Until then, happy hacking!

37 responses

  1. Tom Tromey says:

    The GDB JIT stuff came from Unladen Swallow.
    I agree it is kind of gross; but it is pretty unlikely for anything better to come out of the GDB community -- it has to be driven by the JIT writers.

  2. Roy says:

    I just couldn't help laughing when they suggested FGD JIT for the second time this year. Anyway, I'll write my essay cheap on Javascript updates.

  3. merry christmas 2016 cards says:
  4. New Year 2017 Wishes says:
  5. love quotes says:
  6. new year 2017 says:
  7. Happy New Year 2017 says:

    Hi i was browsing your blog and i found it really interesting! i too have a website.Kindly check it out here

    New year 2017 Happy New Year 2017 Happy New Year 2017 Wishes

  8. happienewyear365 says:
  9. merry Christmas images says:
  10. merry Christmas pictures says:
  11. seo says:
  12. New Year Profile Pictures 2017 says:
  13. Christmas Status In English says:
  14. Download MovieBox says:
  15. YO YO says:
  16. Amesha says:
  17. happy new year 2017 says:
  18. sana says:

    Happy happy new year.Have a best and happy new year.
    Celibrate with wishes to others eg friends, parents, brothers and relatives.
    To bring close them with yourself.Best New Year SMS 2017New Year 2017 Wishes

  19. New Year 2017 Wishes says:

    I love to read this articles. Short Christmas Wishes 2016

  20. Rupali Sharma says:
  21. Gmail says:
  22. New Year Wishes 2017 says:

    New Year is the best event for everyone so celebrate this New Year 2017 with us and send some wonderful and awesome New Year Wishes, Greeting, Quotes and many more for your Love ones. New Year Wishes 2017 New Year Wishes 2017

  23. karan says:
  24. Digi Apps says:
  25. dasdasdsa says:
  26. ADIL says:
  27. bindhu says:

    happy valentines day Hd images and best quality wishes

  28. radha says:

    happy valentines day

  29. shashank says:
  30. Tech Troth says:
  31. james clark says:

    Valentine's Day, also called Saint Valentine's Day or the Feast of Saint Valentine, happy valentines day is an annual holiday celebrated on February 14.happy valentines day messages It originated as a Western Christian liturgical feast day honoring one or more early saints named Valentinus, and is recognized as a significant cultural and commercial celebration in many regions around the world, although it is not a public holidayhappy valentines day sayings in any country. Valentine's Day is celebrated on February 14 Valentine's Day is also a very popular date for weddings..It is a festival of romantic love and many people give cards, letters, flowers or presents to their spouse or partner. They may also arrange a romantic meal in a restaurant or night in a hotel. Common symbols of Valentine's Day are hearts, red roses and Cupid.The most common Valentine's Day symbols are the heart, particularly in reds and pinks, and pictures or models of Cupid. Cupid is usually portrayed as a small winged figure withhappy valentines day pictures a bow and arrow.Many people celebrate their love for their partner by sending cards or letters, giving gifts or flowers and arranging meals in restaurants or romantic nights in hotels. People who would like to have a romantic relationship with somebody may use the occasion to make this known, often anonymously. Valentine's cards are often decorated with images of hearts, red roses or Cupid. Common Valentine's Day gifts are flowers chocolates, candy, lingerie and champagne or sparkling wine

  32. Miss Lona says:
  33. wpaul says:


  34. paul says:
  35. jone robert says:
  36. Translation says:
  37. nikhlesh kumar says:

Leave a Reply