Showing posts with label V8. Show all posts
Showing posts with label V8. Show all posts

Tuesday, May 03, 2011

The Magic of Node.js


A while ago, Google came out with a high-performance JavaScript engine called V8. This is what powers the Chrome browser.

Now along comes an Open Source project called Node.js (or simply Node) that wraps V8 with networking capabilities, enabling some very cool JavaScript-based servers (HTTP or TCP) to be written with just a few lines of code. Servers written for Node are non-blocking and multi-tasking without having to be multi-threaded (the demo below explains more), which also makes them very fast and scalable. This is server-side JavaScript at its best.

This hour-long demo is worth watching. I haven't been so amazed since I saw Scott Davis demonstrate Groovy at JavaOne 2009.

The only downside (not to me, though ;-) is that Node currently only works on Unix-like systems (Linux, Mac) and not yet on Windows. You also have to compile from source (no binaries yet), which is not a big deal because you only have to type "./configure". "make" and "sudo make install" one after the other in the main directory once you've unzipped the tar.gz file using "tar zxvf node-VERSION.tar.gz".

Refcards has a reference card for Node.js.

There are some great possibilities here, such as when you combine this with E4X.