This article is more than 1 year old

Mozilla slips SpiderMonkey into Dev Platform of the Future™

Climbs on servers, aims war cry at Google

Mozilla is building its own version of Node.js – the increasingly popular open source platform for coding server-side applications with JavaScript – moving Node from Google's V8 JavaScript engine to its own SpiderMonkey engine.

"We think V8 is great and the fact that Node has become so widely used is a testament to that. But we also think there’s room for competition here. Browser-based competition is old-hat. Let’s move this battle to the servers," Mozilla man Paul O'Shannessy wrote in a recent blog post.

V8 is the JavaScript engine included with Google's Chrome browser, while SpiderMonkey helps drive Firefox. But the idea here is to transplant the JavaScript language from the client to put it on the server, letting you build the back end of an application in much the same way you build a JavaScript front end.

Though O'Shannessy and his collaborators aim to provide a SpiderMonkied version of Node, they aren't replacing V8 entirely. They've chosen a hybrid approach, implementing the V8 API on top of SpiderMonkey. "We realized that Node was tied pretty closely to V8, and there really wouldn’t be any way to use SpiderMonkey without ripping Node apart and rebuilding it. Not only would that suck now, but it would likely suck long into the future as Node gets updated. This port would fall behind and nobody wants that," he writes.

With his hybrid “V8Monkey” engine, O'Shannessy and his collaborators can simply plug their work into the existing Node platform. He calls his new version of the platform "SpiderNode," and preliminary code is already available on github. There's also a repository for the standalone V8Monkey implementation.

Node.js – the current darling of the Silicon Valley developerati – is an "event-driven" system meant for networking applications that involve heavy I/O. In essence, it doesn't wait for one thing to happen before moving to the next. Its "event loop" needn't preallocate large chucks of memory when a user connects from across the interwebs. It can allocate a small slice of memory that identifies the connection, and then it will use additional memory as needed.

The platform was originally built by an independent developer named Ryan Dahl, who's now on staff at San Francisco-based cloud-computing outfit Joyent. Node underpins Joyent's Amazon-like "infrastructure cloud", and the company has become the open source project's chief steward.

Dahl originally set out to build Node atop Mozilla's SpiderMonkey – the JavaScript engine included with Firefox browser – but this effort didn't last long. After about two days, he switched to Google's V8. "V8 is just a nice, clean library," Dahl told us earlier this year. "It's compact and extracted away from Chrome. It's distributed as its own package, and it's easy to build and it's got a nice header file with nice documentation. It's kind of constrained. It doesn't have dependencies on other things. It seemed much more modern than the Mozilla stuff."

But clearly, O'Shannessy sees things differently. And he says there are some tangential benefits of his V8Monkey engine. "The JS team at Mozilla is also really interested in just having this API around. It has potential for other projects like this, but also raises awareness of API differences and might help push forward changes to the SpiderMonkey API," he says. According to O'Shannessy, the project has already sparked discussion about moving the SpiderMonkey API from C to C++.

But the main idea is to provide an alternative version of Node. ®

More about

TIP US OFF

Send us news


Other stories you might like