I saw this interesting blog post today about where the Native Client (NaCl) team is going. I thought the idea was really intriguing: you compile your code once to LVM bitcode, and then each browser has a JIT’er that will turn that into fast native code. It seems like a possible natural progression from sending scripts across the web; now, the site owner can do a one-time compile step on their powerful server, and get a lot better performance for their clients. Cool.
But then I thought — wait isn’t this like Java? The promise of Java was that you could take your code, compile it once, and then run the resulting bytecode anywhere. I think there are a couple things that NaCl can and will do better than Java: better security model (I think the problem with Java was that developers were limited to writing “Applets”, which wasn’t great), and better performance. But neither of those seem like they’re fundamental to the two designs; it seems like you should be able to design a good JIT’er for Java bytecode almost as easily as for LVM bitcode, and it seems like the security of the two systems could be made just as good. Maybe it’s just the right time for NaCl, or maybe Google/the open source community will execute better. Or maybe NaCl will meet the same fate as Java on the web.