Hacking Devin Torres

JavaScript: The Fastest Dynamic Language?

I remember programming for the web in the late 90’s. JavaScript engines were a lot worse then than they are now, and it was the last programming skill a programmer mentioned. Many programmers didn’t even regard the language as a real language, much the same way many of us today scoff when somebody mentions HTML as a programming skill. What many didn’t realize, though, is that JavaScript has always been a beautiful language when used correctly.

Original JavaScript engines were buggy and slow, which is why it’s taken this long for people to finally appreciate the language. We now have Nitro (SquirrelFish Extreme) from the Apple camp, V8 from the Google camp, and TraceMonkey from the Mozilla camp. Without getting into JavaScript engine wars, they’re all blazingly fast and, apart from Nitro which many take a bit more work, easy to integrate with any project.

I was mulling over how bright the future of JavaScript was when I read this week about a project called Narwhal on Ajaxian. Although I had heard of server-side JavaScript for awhile, I only imagined it being JavaScript without the DOM. I was unaware there was a move to create a true server-side JavaScript. This just means adding standard objects to interact with system-level services, such as the File object.

The implications of all of this is huge. While Ruby and Python have separate projects busy trying to implement fast JITed interpretters for their languages, JavaScript already has three! Imagine writing an entire Rails-like web framework in pure JavaScript. We can take it even further: Imagine writing a WxWidget application using pure JavaScript! Perhaps a cron job in pure JavaScript? Anything is possible. It has potential to become a first rate scripting language along with Python and Ruby. Better even, as any three of our new JavaScript engines could best them both in speed and possibly even memory. Even when Ruby bytecode is run on V8 it can be almost as fast as Ruby 1.9. Both Python and Ruby have problems scaling using threads because of  their GILs. Meanwhile, web worker threading is already implemented in all three engines.

Take V8, one of the many new ServerJS extensions to it, an interactive debugger like IPython such as the one already in the V8 on Python project, a package manager like RubyGems, and bundle it up for Windows, Mac, and Linux and you can call it whatever you like. The worlds fastest dynamic language.