-
Notifications
You must be signed in to change notification settings - Fork 53
Deployment
pepper.js lets a single Pepper plugin be deployed as both a Portable Native Client executable and as JavaScript. Choosing a single technology and sticking with it would make life simpler, but there are advantages and disadvantages to each technology. Deploying different technologies in different circumstances let an application play to the strengths of each.
Portable Native Client generally provides better performance than JavaScript, particularly when threading is leveraged. On the downside, Native Client executables are currently only supported by Chrome. JavaScript has much more pervasive browser support. It should be noted that although JavaScript "runs everywhere," performance can vary widely between browsers, even on the same hardware. Web users also have a wide spectrum of CPU and GPU power. If possible, design your applications to scale across differing amounts of processing power, no matter which technology is being used.
In terms of file size, it appears that Native Client and Emscripten produce executables of roughly the same size, once they are stripped/minimized and gzipped. They are different versions of the same program, so it is unsurprising their compressed sizes are similar.
Portable Native Client translates architecture-independent bitcode files loaded from the web into architecture-specific binaries that can run directly on the user's machine. Before PNaCl, Native Client directly loaded architecture-specific binaries directly. This was inappropriate for the open web, so the original version of Native Client was locked down to only run inside Chrome Web Apps. PNaCl has not yet achieved feature parity with the original version of NaCl, in part because some things are difficult to do architecture independently. For instance, just-in-time (JIT) compilation is supported in NaCl but not PNaCl. NaCl also supports inline assembly, whereas PNaCl does not. If you want to do architecture-specific optimizations and are willing to run as a Chrome Web App, targeting the original version of NaCl may be worthwhile. In general, however, PNaCl is the better choice.
You can build the original Native Client examples with the following commands. ("TOOLCHAIN=newlib" is a historical artifact.)
make TOOLCHAIN=newlib CONFIG=Debug
make TOOLCHAIN=newlib CONFIG=Release