21 June 2011

New JavaScript Engine Module Owner

As you may know, I wrote JavaScript in ten days. JS was born under the shadow of Java, and in spite of support by marca and Bill Joy, JS in 1995 was essentially a one-man show.

I had a bit of help, even at the start, that I’d like to acknowledge again. Ken Smith, a Netscape acquiree from Borland, ported JDK 1.0-era java.util.Date (we both just drafted off of the Java truck, per management orders; we did not demur from the Y2K bugs in that Java class). My thanks also to Netscape 2′s front-end hackers, chouck, atotic, and garrett for their support. EDIT: can’t forget spence on the X front end!

That was 1995. Engine prototype took ten days in May. Bytecode compiler and interpreter from the start, because Netscape had a server-side JS product in the works. The rest of the year was browser integration, mainly what became known as “DOM level 0″. Only now standardized in HTML 5 and Anne’s wg. Sentence fragments here show my PTSD from that sprint :-/.

In 1996 I finally received some needed assistance from RRJ, who helped port David M. Gay and Guy Steele’s dtoa.c and fix date/time bugs.

Also in summer 1996, nix interned at Netscape while a grad student at CMU, and wrote the first LiveConnect. I am still grateful for his generous contributions in wide-ranging design discussions and code-level interactions.

At some point in late summer or early fall 1996, it became clear to me that JS was going to be standardized. Bill Gates was bitching about us changing JS all the time (some truth to it; but hello! Pot meet Kettle…). We had a standards guru, Carl Cargill, who knew Jan van den Beld, then the Secretary-General of ECMA (now Ecma). Carl steered our standardization of JS to ECMA.

Joining ECMA and participating in the first JS standards meeting was an eye-opener. Microsoft sent a B-team, and Borland and a company called NOMBAS also attended. “Success has many fathers” was the theme. The NOMBAS founder greeted me by saying “oh, we’ve been doing JavaScript for *years*”. I did not see how that could be the case, unless JS meant any scripting language with C-based syntax. I had not heard of NOMBAS before then.

At that first meeting, I think I did well enough in meta-debate against the Microsoft team that they sent their A-team to the next meeting. This was all to the good, and Microsoft in full-blooded compete mode, but also with individual initiative beyond the call of corporate duty by Shon Katzenberger, materially helped create ES1. Sun contributed Guy Steele, who is composed of pure awesome. Guy even brought RPG for fun to a few meetings (Richard contributed ES1 Clause 4).

Meanwhile, in fall 1996, I was under some pressure from Netscape management to write a proto-spec for JS, but that was not something I could do while also maintaining the “Mocha” engine all by myself in both shipping and future Netscape releases, along with all of the DOM code.

This was a ton of work, and on top of it I had to pay off substantial technical debt that I had willingly taken on in the first year. So I actually stayed home for two weeks to rewrite Mocha as the codebase that became known as SpiderMonkey, mainly to get it done (no other way), also to go on a bit of a strike against the Netscape management team that was still underinvesting in JS. This entailed garbage collection and tagged values instead of slower reference-counting and fat discriminated union values.

Also in fall 1996, chouck decided to join me as the second full-time JS team-mate. He and I did some work targeting the (ultimately ill-fated) Netscape 4 release. This work was ahead of its time. We put the JS engine in a separate thread from the “main thread” in Netscape (still in Mozilla). This allowed us to better overlap JS and HTML/CSS/image computations, years ahead of multicore. You could run an iloop in JS and the “slow script dialog” seamlessly floated above it, allowing you to stop the loop or permit it to continue.

After summer 1996 and the start of ECMA-262 standardization, Netscape finally invested more in JS. Clayton Lewis joined as manager, and hired Norris Boyd, who ended up creating Rhino from SpiderMonkey’s DNA transcoded to Java. This was ostensibly because Netscape was investing in Java on the server, in particular in an AppServer that wanted JS scripting.

I met shaver for the first time in October 1996 at Netscape’s NY-based Developer Conference, where he nimbly nerd-blocked some Netscape plugin API fanboys and saved me from having to digress from the main thing, which was increasingly JS.

Some time in 1997, shaver contributed “LiveConnect 2″, based on more mature Java reflection APIs not available to nix in 1996. Clayton hired shaver and the JS team grew large by end of 1997, when I decided to take a break from JavaScript (having delivered ES1 and ES2) and join the nascent mozilla.org.

I handed the keys to the JS kingdom to Waldemar Horwat, now of Google, in late 1997. Waldemar did much of the work on ES3, and threw his considerable intellect into JS2/ES4 afterwards, but without overcoming the market power and stalling tactics of Microsoft.

True story: Waldemar’s Microsoft nemesis on TC39 back then, at the time a static language fan who hated JS, has come around and now endorses JS and dynamic languages.

Throughout all of this, I maintained module ownership of SpiderMonkey.

Fast-forward to 2008. After a great (at the time) Firefox 3 release where @shaver and I donned the aging super-hero suits one more time to compete successfully on interpreter performance against JavaScriptCore in WebKit, Andreas Gal joined us for the summer in which we hacked TraceMonkey, which we launched ahead of Chrome and V8.

A note on V8: I’d learned of it in 2006, when I believe it was just starting. At that point there was talk about open-sourcing it, and I welcomed the idea, encouraging any of: hosting on code.google.com, hosting without any pressure to integrate into Firefox on mozilla.org (just like Rhino), or hosting with an integration plan to replace SpiderMonkey in Firefox. I had to disclose that another company was about to release their derived-from-JS engine to Mozilla, but my words included “the more the merrier”. It was early days as far as JS JITs were concerned.

V8 never open-sourced in 2006, and stealthed its way to release in September 2008. This may have been a prudent move by Google to avoid exciting Microsoft. Clearly, in 1995, the “Netscape + Java kills Windows” talk from Netscape antagonized Microsoft. I have it on good authority that a Microsoft board member wrote marca at the end of 1995 warning “you’ve waved the cape in the bull’s face — prepare to get the horns!” One could argue that Chrome in 2008 was the new red cape in the bull’s face, which begot IE9 and Chakra.

Whatever Google’s reasoning, keeping V8 closed-source for over two years hurt JS in this sense: it meant Apple and Mozilla had to climb the JIT learning curves on their own (at first; then finally with the benefit of being able to inspect V8 sources). Sure, the Anamorphic work on Self and Smalltalk was somewhat documented, and I had learned it in the ’90s, in part with a stint on loan from Netscape to Sun when they were doing due dliigence in preparation for acquiring Anamorphic. But the opportunity to build on a common engine codebase was lost to path dependence.

On the upside, different competing open source engines have demonstrably explored a larger design space than one engine codebase could under consolidated management.

In any event, the roads not taken in JS’s past still give me pause, because similar roads lie ahead. But the past is done, and once we had launched TraceMonkey, and Apple had launched SquirrelFish Extreme, the world had multiple proofs along with the V8 release that JS was no longer consigned to be “slow” or “a toy”, as one referee dismissed it in rejecting a PLDI submission from Andreas in 2006.

You know the rest: JS performance has grown an order of magnitude over the last several years. Indeed, JS still has upside undreamed of in the Java world where 1% performance win is remarkable. And, we are still at an early stage in studying web workloads, in order to synthesize credible benchmarks. On top of all this, the web is still evolving rapidly, so there are no stable workloads as far as I can tell.

Around the time TraceMonkey launched, Mozilla was lucky enough to hire Dave Mandelin, fresh from PhD work at UCB under Ras Bodik.

The distributed, open source Mozilla JS team delivered the goods in Firefox 4, and credit goes to all the contributors. I single Dave out here because of his technical and personal leadership skills. Dave is even-tempered, super-smart, and a true empirical/skeptical scientist in the spirit of my hero, Richard Feynman.

So it is with gratitude and more than a bit of relief, after a very long 16 years in full, 13 years open source, that I’m announcing the transfer of SpiderMonkey’s module ownership to @dmandelin.

Hail to the king, baby!

38 Responses to “New JavaScript Engine Module Owner”

  1. Dan says:

    Great post, but it lacks an answer to the question: why?

  2. Brendan Eich says:

    @Dan: You think 13+ years isn’t enough of a reason? :-P

    More in the way of an answer in forthcoming posts on what I’m cooking up with Mozilla Research.

    /be

  3. Brendan Eich says:

    (Connoisseurs must click on the “drafted” link.)

  4. Brendan Eich says:

    (And *everyone* must click the “Hail to the king, baby!” link ;-)

  5. Yuhong Bao says:

    You should mention JSSS and how it was used to emulate CSS in Netscape 4. Which reminded me of another question: What if Netscape “Mariner” was not cancelled back in 1998?

  6. Justin Long says:

    Congratulations!

    Will you have more time to work on ES.next (and ES.next.next)?

    It’s amazing to watch your talks on evolving the language, and what you see ES coming to soon. Can’t wait to hear the next chapter!

  7. [...] Brendan Eich is a treasure. Some of the quotes above are from a great bit of history around JavaScript and the engines that run it. [...]

  8. Brendan Eich says:

    @Yuhong: JSSS was a dirty hack on top of Netscape’s pre-CSS layout engine. Sorry, not worth the mention IMHO. For all its issues, CSS was destined to win.

    @Justin: I’m spending a lot of time on ES.next and the larger Harmony agenda/process, as recent talks including at #txjs indicate.

    /be

  9. Chandru says:

    Brendan – job well done and good luck to Dave.

  10. Yuhong Bao says:

    Brendan Eich: Yes, but what I was thinking was the CSS-to-JSSS translation, which was even worse. And almost nobody mentioned that the source code for it is public in the Mozilla Classic codebase:
    http://mxr.mozilla.org/classic/source/lib/libstyle/

  11. Daniel Glazman says:

    JSSS was not the worst idea ever and the current DOM, at least for its CSS OM part (whatever you think of it), benefited a bit from it. JSSS proved JavaScript-based direct manipulation of styles is not only possible but also useful. FWIW, some parts of JSSS could be today inspiring for a revamp of the CSS OM…

    I should also mention Netscape’s ActionScripts, one of the two first attempts to add JS-based behaviours to HTML elements. I still remember my evaluation of Netscape ActionScripts vs. Microsoft HTCs in Redmond in front of Angus Davis and Vidur Apparao IIRC.

  12. Brendan Eich says:

    @Daniel: right, ActionSheets. IIRC my name is on the w3c submission ;-).

    /be

  13. Yuhong Bao says:

    “IIRC my name is on the w3c submission ;-) .”
    Yes, I noticed that on the JSSS submission.
    And what is even worse, Netscape cancelled Mariner, and Gecko took years before it was reasonably stable, leaving no new release in time to compete against IE5.

  14. Brendan Eich says:

    @Yuhong: the Mariner story will have to be told in full another day. I was involved in it, shaver too — it was part of a larger “Hawaii” (5.0, get it) proposal to get back to the market sooner, without a total rewrite. Netscape management, under influence from the Raptor team, did not go for it.

    Joel Spolsky has written about this as a big mistake. I’ve called it a good move for opening up Mozilla to standards-focused contributors, who eventually did help get Gecko (neé Raptor) in shape.

    It’s hard to say how Netscape would have fared had it shipped a Netscape 5 that was better incrementally but probably not in absolute head-to-head terms against IE. Microsoft had put a lot of extra work (some good) into IE. Netscape was having trouble making money (and once bought by AOL, having trouble justifying the acquisition price).

    My belief is that Netscape was going to lose market share no matter what, due to IE bundling. Mozilla needed green fields. The payoff came years later when IE was popup- and malware-infested and stagnated on purpose, and we were ready with Firefox.

    /be

  15. Yuhong Bao says:

    “The payoff came years later when IE was popup- and malware-infested and stagnated on purpose,”
    And as it happens, IE6 in XP SP2 added a popup blocker and increased security, and was released just before Firefox 1.0, BTW. The rendering and most of the rest was still the same though.
    Anyway, don’t forget the WaSP too:
    http://www.mozillazine.org/talkback.html?article=1524
    http://www.mozillazine.org/talkback.html?article=88

  16. Yuhong Bao says:

    And don’t forget the Netscape 6.0 release in 2000 which was widely considered a disaster.

  17. Brendan Eich says:

    Netscape 6 played its part too, as a negative result that helped Mitchell and me level the playing field, e.g. by making Netscape new-hires go through the same patch submission / review process as “external contributors” in order to get CVS commit access. We also instituted super-review.

    We knew Netscape 6 was going to be bad. So did the rank and file at Netscape, who begged not to ship. It was the upper management that needed to save face with AOL and show that their “Raptor” bet was somehow about to pay off.

    Around this time the Mozilla builds, originally made for testers, became as popular as Netscape’s product builds — or more popular.

    /be

  18. Yuhong Bao says:

    Don’t forget this which summarize the entire mess:
    http://www.mozillazine.org/talkback.html?article=1708

  19. Brendan Eich says:

    @Yuhong: you keep writing “Don’t forget… and don’t forget….”

    I wish I could forget some of the history!

    But things have turned out better and better since Firefox launched.

    The fight goes on, new battle lines form. History may rhyme but it won’t repeat, and no point crying over spilled milk.

    /be

  20. Patrick Corcoran says:

    Deep bow to you, sir.

    I worked at HotWired in 1995 when I started writing JavaScript — it was the same day that JS was released to the world with little fanfare (and even less documentation) to accompany the first beta of Netscape 2.

    In the days since, I am certain I have written more JavaScript than all other languages combined. My career, my professional life, my family… none of these things would be as they are today if your language had taken a different path.

    I have always wanted to be able to thank the universe for gifting me a computer dialect that fits like a second skin. Perhaps you could be so kind as to pass along my message.

  21. Andy Wingo says:

    A well-deserved respite, and a worthy replacement. Happy hacking, Brendan!

  22. Weng Fu says:

    I would like for reading more softs story like this. I think the soft of JS is still not as good as the soft of VB6 but the JS is now the popular soft and will get the better.

  23. Thomas says:

    Brendan, I’d like to thank you personally for putting real closures into JavaScript.

    While I’m not too great a fan of JS, you certainly did a great job for a 10-day constraint. Did you have any experience in designing languages before JS? It looks like you were inspired by Self and perhaps Scheme.

  24. Daniel Glazman says:

    D’oh. Yes, Action Sheets, not ActionScripts.
    http://www.w3.org/TR/NOTE-AS.html
    My evaluation is (W3C Member only, sorry) in http://www.w3.org/Style/Group/1998/09/f2f.html (look for “* Actions/behaviors”)

    note to self: wake up _totally_ before posting comments on blogs…

  25. Ray Whitmer says:

    As always, I have the greatest respect for your work. JS is amazing and many other related things in Mozilla are likewise great, getting done what Sun Java and others ultimately never did, effective client-loadable code. That you and others sometimes made it look so easy adds to the genius and great work involved.

    As I glance (for the first time) through the new draft of Anne’s WG, of particular interest to me, the simplifications and cleanup were badly needed. The new draft looks beautiful with significant warts removed, some involving DOM level 0 sacred cows and implementations (however adamant various parties were to preserve things in the past) and also many mistakes of later add-ons that were essential but needed refinement or were not and needed removal. This does not to take anything away from prior Mozilla implementations or standardizations, done by many outstanding developers. It is amazing all the things that were right in Netscape’s DOM Level 0, but getting a standard that moves forward and is really supported has always been quite a messy wrestling match. I am also glad it feels like DOM level 0 to you at this point, however much it may have benefited from improvements and experience of Mozilla and other developers over time.

    Different people will focus in on different parts of a specification. I would be interested in knowing what the biggest changes are that make it feel more like DOM level 0 to you, specific things missed or added by DOM levels 1 – 3 that needed to be corrected or removed.

  26. [...] who invented JavaScript More than 16 years ago under the name Mocha while working at Netscape, announced that David Mandelin now owns the JavaScript module. As a result, JavaScript, which has been [...]

  27. Great to hear this history. Dave just did a talk at Velocity last week on JS engines ( http://velocityconf.com/velocity2011/public/schedule/detail/18087 ). I thought it was one of the best talks of the conference and the comments agree. Dave is incredibly knowledgeable.

  28. Great write-up, Brendan!

    Any talk of early JavaScript reminds me of those god-awful “free javascripts for webmasters!” sites with thousands of cool effects, like letters following your mouse, raining cats, and the inimitable 1000-chained-popups gag.

  29. Daniel says:

    Hi Brendan, I think it’s clear why some things work fine and other don’t: amazing to see that mozilla has not only great technical guys but incredible open-minded people commanding their developments.

    Thanks

  30. [...] Brendan Eich transfers ownership of JS module [...]

  31. Brendan Eich says:

    @Joss: do you mean like the joke home page my Netscape colleagues made for me?

    http://web.archive.org/web/20000815055653/people.netscape.com/brendan/

    It gratuitously fired up Java via LiveConnect, to add salt to the wound!

    /be

  32. Yes! haha!

    But there were also sites with thousands of free javascript widgets and codes for your sites, i remember – for a while at school it became a semi-serious competition to see who could have the website with the most impressive (/annoying) javascript features. I remember having a shipping calculator with grossly inflated margins and rude error messages – despite having nothing to sell – among others. Hacking around with those was where it all started for me i think, strangely enough..

  33. [...] So it is with gratitude and more than a bit of relief, after a very long 16 years in full, 13 years open source, that I’m announcing the transfer of SpiderMonkey’s module ownership to @dmandelin.—— Brendan Eich [...]

  34. Yuhong Bao says:

    Of course, there is also the matter of the fact that the first CSS draft was published in October 1994:
    http://groups.google.com/group/comp.infosystems.www.authoring.html/msg/358f05eb3e9a79b5?pli=1
    http://yuhongbao.blogspot.com/2011/06/history-of-css-part-1.html
    And it certainly didn’t help CSS that IE3 and IE4 did not fully comply with CSS1 either.

  35. Yuhong Bao says:

    Also published on my blog:
    http://yuhongbao.blogspot.com/2011/06/history-of-css-part-1.html
    As a result of the problems, the early uses of CSS was generally to control the font.

  36. [...] couple of weeks ago Brendan wrote a post about delegating authority for the JavaScrpt module to dmandelin. It’s a beautiful post, combining an official change in authority with history and humor. [...]

  37. [...] couple of weeks ago Brendan wrote a post about delegating authority for the JavaScrpt module to dmandelin. It’s a beautiful post, combining an official change in authority with history and humor. (And of [...]