Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2569 posts at DZone. You can read more from them at their website. View Full User Profile

Pumping 'Iron' for JavaScript

01.27.2010
| 8055 views |
  • submit to reddit
The newest member of the "Iron" family, IronJS, is an ECMAScript (JavaScript) implementation built on top of the .NET Dynamic Language Runtime (DLR).  DZone got a chance to speak with Fredrik Holmström who wrote IronJS.  He's performed some benchmarks comparing IronJS and Jint, which is a similar implementation, and he said that a 0.1 release is coming soon.  Holmström told DZone his reasons for creating IronJS and how he thinks it will benefit the .NET community.

IronJS allows developers to embed a JavaScript runtime into .NET applications.  It joins IronPython and IronRuby on the list of dynamic language implementations for Microsoft's platform.  Currently, JScript is Microsoft's own version JavaScript, but the attempts to deliver Managed JScript on the DLR fell apart.  Because of JScript's shortcomings, Microsoft might want to bring Holmström's project in-house like it did for IronPython and IronRuby if IronJS takes off.

Holmström has already tested his implementation against a similar project called Jint.  Both projects are implementations for the .NET Common Language Runtime, but only IronJS runs on the DLR.  The benchmarks recorded set variable performance, function call performance, and member access performance.  IronJS was significantly faster than Jint in all of Holmström's tests: it was 3 times faster in member access performance, 6 times faster in set variable performance, and about 11 times faster in function call performance.  Holmström has also posted a recent unit test showing that IronJS now compiles jQuery 1.4:



Holmström explained his motivation for writing IronJS to DZone.  "There are two main reasons for making IronJS," he said.  "The first one popped in my head about a year ago - I was playing around with some of the databases that speak JSON (Most notably CouchDB), I realized that both the client and the database of my next application would both be speaking JSON and JavaScript, but not the server - this created a sort of mis-match between the different parts of the application and a lot of functionality had to be duplicated between the client and server.  The second reason is a more personal one, I currently have two other projects (who both will be open source, when the time comes) who are in dire need of a JavaScript runtime that they can embed, and at the end of last year I was looking for a JavaScript runtime for .NET that would satisfy the three following conditions:

1) Free and Open Source
2) Actively developed
3) Fast

After searching for almost two months for a suitable JS runtime I simply realized that if I wanted it I'd have to do it myself.  I started working on IronJS in the beginning of January this year, so a bit more than three weeks have passed since I wrote the first line on what was to become IronJS."

                        

DZone asked Holmström what benefits he hopes to bring to the .NET developer community with IronJS and what his overall vision is for the project.  He said, "It will allow embedding of a free, open and (hopefully) fast JavaScript runtime in any .NET application.  With all the JavaScript and JSON development going on today this opens up a plethora of possibilities ranging from integration with other services to simple scripting tasks."

"My vision is to create an ECMA Script 5.0 (the current goal is ECMA Script 3.0, though) compliant implementation, that is open and free," said Holmström.  "I also want to work with, or at least follow the progress of, the CommonJS initiative, and if it takes off (as I think we all hope it will) I want to provide an implementation of those libraries for IronJS as well. As I said, I have two other projects relying on IronJS as a script runtime that are heavily tied to web development - I'm not ready to expose them to the public yet though - IronJS is an important part of making these two projects work also."

Iron JS is licensed under the GNU General Public License v3.  It requires .NET 4.0 Beta 2, since a few C# 4.0 specific features, like covariance, are used.