Are the new JavaScript engines going to completely change the game?

Last week, a gentleman wrote on his blog about the performance of CPython, Jython and IronPython in creating an empty binary tree to demonstrate a performance problem in IronPython.

The article was posted to Reddit, but I thought that the demonstration of other how dynamically typed languages performed was more interesting than the comparison of the different Python implementations. Among the implementations submitted were Slava Pestov’s Factor version and my own version in Clojure. On my home PC, creating a binary tree of depth 22 took 549 seconds in Python, 14 seconds in Clojure and 4 seconds in Factor.

But my biggest surprise was when I tried a JavaScript implementation with Google’s V8 engine: it executed in 1.8 seconds. That is 300 times faster than the Python implementation. I have not (yet) done any serious benchmarking of V8, but I think it’s not completely unreasonable to expect that its performance is better than Python’s in most cases.

Now, I’m sure we’ve all joked at some point in the past about JavaScript being slow, but V8 — and from what I hear, WebKit’s JavaScriptCore — sound like game changers. The better performance would surely be a major factor in creating more complex web-based applications and the little language that everybody laughed at and relegated to cutesy web page effects could suddenly become a very important player in a lot of other fields. Here are a few from the top of my head:

  • Server-side web programming*
  • General purpose scripting*
  • General purpose programming*
  • Embedded language in applications such as productivity suites or games
  • Extension language for Emacs-like applications
  • Mobile device programming language

* Given that it has a decent standard library

The possibilities are very vast, and because JavaScript is already known by a lot of programmers, adoption would certainly be easy. Damn, was Steve Yegge right?

About these ads

11 thoughts on “Are the new JavaScript engines going to completely change the game?

  1. I’ve been considering the same for a while or since Mozilla, Google and Webkit started juicing up their JS engines. Makes perfect sense, at least for web pages to use the same language at the server and client sides.

    But to be clear, I’ve never been the biggest fan of Javascript.

  2. While the numbers for V8 are impressive, this benchmark basically measures how fast memory allocation is.

    Besides, it’s interesting to note that since Clojure uses immutable data-structures with structural sharing, a “blank” tree can be allocated in a time linear to its length. Other allocations occur only when the tree is “modified”.

  3. There is something wrong with your web site. Every time I point to a link, a popup trashes my modem’s bandwidth.

  4. Just creating a binary tree mostly tests the allocation strategy. Having a big enough heap to start out with could make that trivial.
    You could try porting the Splay benchmark from the V8 Benchmark Suite to Python as well, to more thoroughly check the memory management (both allocation and garbage collection). It should create enough garbage that no implementation can avoid handling it :)

  5. Pingback: Top Posts «

  6. Pingback: iPhone, Palm Pre, or some random Android phone? « Compl33t

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s