Google Introduces Portable Native Client, Makes It Easier For Developers To Add C And C++ Code To Their Web Apps

Native Client – a technology that allows developers to run native compiled C and C++ code as part of their web apps – has long been a part of Google Chrome. Even though other browser vendors haven’t adopted it yet, Google is clearly putting quite a few resources behind this technology and at I/O this year, it announced Portable Native Client (or PNaCl, which Google says we should pronounce as “pinnacle”). PNaCl is now available in developer preview in Chrome 29 and will slowly find its way into the stable version over the coming months.

PNaCl, the company says, will allow developers to write web applications “that are truly architecture-independent.” It’s essentially an architecture-independent version Native Client, so unlike now, developers can write their apps and know that they will run on ARM and X86 (both 32-bit and 64-bit). PNaCl, the team says, uses an LLVM compiler infrastructure with a “compile -> link -> translate” workflow that creates an intermediary bitcode, which is then translated locally for the specific infrastructure.

That’s some pretty complicated stuff, but essentially it will allow developers to write high-performance apps that offer near-native speeds for today’s existing platforms and they can be sure that these apps will also run on new architectures as they become available without having to rebuild their apps (assuming, of course, that Google will continue to support this product).

Other browser vendors, of course, are also trying to speed up web apps. Most recently, for example, Mozilla announced the asm.js project, which ports C and C++ code to asm.ja – a subset of JavaScript. This scheme, Mozilla says, allows JavaScript code to run at speeds within 2x of native performance. That’s not quite what Native Client can achieve, but the advantage of Mozilla’s approach is that the JavaScript code that the system generates will run in any browser – just slower than on Firefox.