Architecture, smarchitecture ... Get .exe speed on the web

Google has shipped the stable release of version 31 of its Chrome web browser, and with it the first generally available version of its Portable Native Client (PNaCl) compiled-code technology for the web.

First unveiled at the Google I/O developer conference earlier this year, PNaCl is an updated version of the Native Client (NaCl) technology that has been present in Chrome since 2011.

NaCl allows developers to write modules for sandboxed web apps in C/C++, rather than JavaScript. These compiled binary modules can then be downloaded by a user's web browser and executed on the local CPU, taking advantage of the full computational power of the user's PC.

Because NaCl modules are essentially binary executables, however, developers must build separate versions of them for each processor architecture, including 32-bit and 64-bit Intel chips, ARM, and so on.

PNaCl (pronounced "pinnacle") eliminates this problem by compiling the modules into an intermediary format instead of executable code, then having the browser complete the final compilation step for whichever architecture it's running on.

The tech is now available in the stable releases of Chrome for Windows, OS X, Linux, and Chrome Frame.

Google wouldn't mind seeing it show up in other browsers, too – it's open source – but don't hold your breath. The Mozilla Foundation, for one, has pooh-poohed the idea of browsers running native code since Google first floated it in 2010. Microsoft, on the other hand, has offered ActiveX as its own take on native code for the web for years now and isn't likely to change gears.

Developers who write PNaCl modules can still have their code run on non-Chrome browsers, however, by compiling them to JavaScript using the Emscripten compiler and Google's pepper.js library.

You can see some PNaCl code in action – both executing natively and via the browser's JavaScript interpreter – by visiting Google's examples gallery (though to run the native versions you'll need to be sure your copy of Chrome is up to date). ®