12 ms·
Portable Native Client
- bsimpson 13y agoBe interesting to see if this becomes a target for other languages, e.g. allowing browser applications to be written in Python.
- eliben 13y agohttp://gonativeclient.appspot.com/demo http://gonativeclient.appspot.com/demo has a Lua interpreter demo. There's also Python, but you'll have to build it yourself (naclports).
- pedrocr 13y agoI really really hope that this+pepper.js will allow you to deploy Ruby/Python/Go as client-side languages for the Web. Does anyone know how (P)NaCl interfaces with the DOM?
- duhroach 13y agoYou don't have direct access to the DOM inside of NaCl, but you can pass messages back to JS via PostMessage.
- cliffbean 13y agoWe've had other languages running in browsers for quite a while now. eg.: http://mozakai.blogspot.com/2013/05/lua-in-javascript-running-vm-in-vm.html http://mozakai.blogspot.com/2013/05/lua-in-javascript-runnin...
- leoc 13y agoWhat would be really great to see is someone putting a HTML client/DOM implementation/etc. inside a PNaCL application. This is after all how things ought to be: ideally you implement your DSL/document viewer inside your general-purpose runtime, instead of kludging your document-format specification up into an application runtime. None of the big browser vendors (including Mozilla and Google itself) is going to welcome such an idea though, as it threatens their de facto control over Web standards.
- mindcrime 13y agoinstead of kludging your document-format specification up into an application runtime So glad to see somebody else saying this. I think you are absolutely correct. The current state of web applications / web browsers is an absolute kludge. Whatever happened to "separation of concerns" or the idea of building tools that do one thing and do it well? But what "one thing" does a web browser do these days? One might think "browsing hypermedia content" but what does that have to do with becoming the universal application runtime?!?!?? Actually, the more I think about it, the more I think "clusterfuck" would be an even more apt term than "kludge" for what we have now. But I largely blame Sun: IF they had bothered to ship something like the Consumer JRE about 7 or 8 years sooner, and IF they hadn't screwed the pooch so badly on security, we could have something like Java / JNLP for hosting "applications" while the actual browser could stick to, well, browsing. I'm actually waiting for something to come along and become "the next Java / Flash" but done right. :-( I'm curious to see to what extent PNaCL can fulfill some of that.
- _prometheus 13y ago> What would be really great to see is someone putting a HTML client/DOM implementation/etc. inside a PNaCL application. Yes! We'd need a bunch of tooling re-built for each platform, but we could do it with static compilation :) > instead of kludging your document-format specification up into an application runtime. Seriously. It's a mess.
- pjmlp 13y agoYou mean WPF?
- leoc 13y agoI assume that the content-to-presentation stack would include something XAML-ish (or indeed XUL-ish) near the presentation end, sure.
- wmf 13y agoThis is a similar idea to the MSR Embassies project: http://research.microsoft.com/en-us/projects/embassies/ http://research.microsoft.com/en-us/projects/embassies/
- tluyben2 13y agoIt says 'LLVM style intermediate code'; why not actual LLVM intermediate code? What would be the reason for an alternative? If it would be actual LLVM code it would be easier to compile from programming languages and to different backends, right?
- lucian1900 13y agoLLVM bitcode is quite large and not really suited to being a transport format. The bytecode they did come up with is probably a LLVM frontend.
- drp4929 13y agoAny reference to support your claim that LLVM bit code is quite large ?
- lucian1900 13y agoIt's quite obvious if you look at the spec. It retains very large amounts of information that is simply not needed merely for executing programs, but is quite useful for compiler backends and tools. It's quite smart to write a LLVM backend and frontend for a custom (compact) bytecode.
- flohofwoe 13y ago"Finalized" and gzipped PNaCl code is about the same size as gzipped x86 or gzipped emscripten-generated JS code. PNaCl code seems to have a static overhead of about 400kByte, probably statically linked code which is either handled through Web APIs in emscripten, or dynamically linked CRT in native executables.
- mccr8 13y agoIt is based on LLVM, but presumably they have to modify it for their particular needs. The PNaCl bitcode reference manual goes into more detail: https://developers.google.com/native-client/dev/reference/pnacl-bitcode-abi https://developers.google.com/native-client/dev/reference/pn...
- icefox 13y agoAnyone know why it takes so long to load any of the demos on http://gonativeclient.appspot.com/demo/bullet http://gonativeclient.appspot.com/demo/bullet ? They simply take way to long.
- eliben 13y agoThe PNaCl translator takes time to optimize the bitcode to highly-efficient machine code (which is almost on par with native performance). This only happens the first time you load the demo - afterwards the output is cached and the load should be instantaneous. Translation time is one of the highest priorities of the PNaCl team and it should become significantly better in the future.
- 0x0 13y agoWow, that's a flashback to the <applet> days!
- icefox 13y agoSadly even after it loads and hitting refresh I still see a progress bar. As google knows loading time really really matters and for such small demos it does not look good that it takes 10(?) seconds to load. Makes me wonder about larger applications.
- cdash 13y agoI am not having that problem, after the first load it is instant for me.
- eliben 13y agoDoes it take the same amount of time to load on subsequent runs as on the initial run? This should not happen. Are you running in incognito mode, perhaps? (in that case, caching doesn't happen for obvious reasons). Feel free to submit a report on the native-client-discuss mailing list or through the bug tracker.
- 13y ago
- cia_plant 13y agoPNaCl has been in development for a while, I'm having trouble understanding just what is being announced here. Is PNaCl now enabled by default in Chrome? I also hadn't seen pepper.js before, is that new?
- devrelm 13y ago> http://codepen.io/lbebber/pen/xrwja http://codepen.io/lbebber/pen/xrwja I think so. I just updated to Chrome 31 and it brought up a UAC in windows, which probably means that it was installing the PNaCl runtime since it usually doesn't require a UAC.
- mavhc 13y agoOr it could be Chrome asking to switch to installing in Program Files instead of User profile.
- mistercow 13y ago> Is PNaCl now enabled by default in Chrome? I just updated, and in chrome://flags, the "Enable Portable Native Client" option has changed to "Disable Portable Native Client". So yes, apparently.
- amaks 13y agoIt was NaCL which was previously available. This one is Portable NaCL which presumably can run the code built from the same intermediate machine code on various platforms (ARM, x86/64, etc). The immediate winner here is which runs on ARM and x64.
- azakai 13y agoThe news is that PNaCl has been enabled on the web in the latest release of chrome. Previously it shipped but ran only on the chrome web store and whitelisted sites like plus.google.com. Also pepper.js is a fairly recent thing, yes.
- thrownaway2424 13y agoThe demos are cool, but are there any among them that can't be done in JS? I know I've seen Voronoi polys in JS that were way less janky than the one in the PNaCL demo.
- spot 13y agothe voronoi is the only one that i think is competitive in JS. js has plenty of 2d physics sims but i have yet to see a decent 3d one like this.
- thrownaway2424 13y agoAre you saying that some of these can't be done in JS, or just that they're more efficient in PNaCl?
- binji 13y agoThey can all be done in JS (modified to remove threading, of course). In fact, many of them already run in emscripten/pepper.js (see http://trypepperjs.appspot.com http://trypepperjs.appspot.com).
- cdash 13y agoWhich is a pretty big deal imo considering Voroni goes from 3.3 fps with 1 thread to 12 fps with 8 threads on my laptop with an intel quad core with hyperthreading.
- leoc 13y agoWell, presumably you could implement a language with bignums in PNaCL with reasonable efficiency, something which is evidently not possible in JS.
- azakai 13y agoWhy is that evidently not possible? :) Serious question, I would guess anything that can be done in C - and bignums can - could be done well in JS, because typically C code compiled to JS runs at about half the speed of native. If you have results showing otherwise for bignums, I would be very interested. Anything special about that particular problem?
- RyanZAG 13y agoUgh. Sounds like the next IE6 is here... Can't wait to log into a bank that demands I installed Chrome to use their new 'security' or some web apps that won't run in anything but Chrome.
- pkulak 13y agoThis seems like more of a ChromeOS move to me, so that you can run native code on Atom and X86 machines. The knock on ChromeOS is always that it's "just a browser". I seriously doubt anyone is going to write their Etsy storefront in NaCl. The benefit here, of course, is that if someone does write the next Photoshop for ChromeOS machines, it should also run fine in OS X, Windows and Linux. Seems like a win for portability to me.
- vertis 13y agoOn the other hand, I can imagine that there is a set of people that want to run client side and yet not expose even obfusticated javascript.
- cliffbean 13y agoPNaCL and asm.js are roughly the same in terms of "exposing" the code in this sense. Both can be easily disassembled/prettified using readily tools readily available today.
- 0x0 13y agoThat worked out well for Java.
- ryanackley 13y agoNo, but it did for Flash.
- 0x0 13y agoLet's just say I'm pretty happy I'm not maintaining any products built with Flex/Air.
- willvarfar 13y agoGreat news for zerovm too! Will this mean apps that run seamlessly on ARM and X86 boxes?
- _random_ 13y agoVery good news! A lot of developers don't like JavaScript and HTML. Google started to listen. I really hope the rest of big players will follow the suite.
- oblio 13y agoBe careful what you wish for because it might come true. A lot of people don't like the Open Web and are clamoring for something obfuscated. Longer term is lose-lose for everyone.
- roarroar 13y agoOh, piss off. There's nothing less "open" about PNaCl over obfuscated JS.
- _random_ 13y agoI don't understand how Web can be "Open" if your choice of language is limited to JS, HTML and CSS that are changing as quickly as standards committee is managing to react. And transpilers are just a second-class-citizen hack trying to make the best of situation.
- cgh 13y agoSo PNaCl + llgo means Go in the browser, right? Now that is something to think about right there.
- 13y ago
- djvu9 13y agoasm.js is a better answer.
- roarroar 13y agoWhat's this based on, exactly? It's slower and the design puts the optimiser in the TCB. PNaCl is a hack arguably with some problems with dynamic code, but short of getting the OS designer to do their job and provide proper sandboxing it's about as good as you're going to get. asm.js is the textbook example of a "worse is better" expediency, like the one that got us stuck with JavaScript in the first place.
- general_failure 13y agoWhat's the question?
- cia_plant 13y agoHow many layers of indirection can we put between the developer and the machine?
- burstmode 13y agoI'm sure there is some space left for fancy named design patterns and a template library with lambda support. You know you can't write a website without lambdas, don't you ?
- pjmlp 13y agoSomething that is standard and vendor neutral.
- querulous 13y agoa platform neutral compiler target
- deleted 13y ago[deleted]
- peterhunt 13y agoFor anyone who works on Chrome: does this mean that Chrome won't move to support asm.js? I tried searching the bug tracker and discussion group and couldn't find anything. In general I'm really happy that we're getting faster (no-gc) runtimes, but I think I favor asm.js's approach due to its backwards compatibility (though I admit I am not aware of the nuances of each implementation).
- elisee 13y agoChrome has taken the approach of working on improving their V8 engine to (hopefully) achieve similar performance to Firefox's specialized asm.js AOT codepath but without any special handling of the "use asm" directive (which gives Firefox guarantees about variable types & stuff like that). See https://news.ycombinator.com/item?id=6553794 https://news.ycombinator.com/item?id=6553794 for a discussion on the subject.
- peterhunt 13y agoGreat, thank you for the link!
- misuba 13y agoThey provide pepper.js, which does a similar trick for PnaCl stuff.
- _prometheus 13y ago> backward compatibility IMO NaCl is much more backwards compatible, letting you recompile old code-bases for the web with minimal changes. The javascript approach (even with the speed gains of asm.js) does not have threads/native instructions/etc. I want chrome to support asm.js, and firefox to support NaCl. Winning all around. > though I admit I am not aware of the nuances of each implementation Perhaps a neutral discussion page is needed... I'll see about making one.
- pcwalton 13y agoYou don't have native instructions in PNaCl, which is what this is about.
- azov 13y agohttp://en.wikipedia.org/wiki/ActiveX http://en.wikipedia.org/wiki/ActiveX - 1996 is knocking… yes, I know - it's very, very different this time, but still can't help remembering the horrors of ActiveX :) PS. From Wikipedia article: In principle it [ActiveX] is not dependent on Microsoft Windows, but in practice, most ActiveX controls require either Microsoft Windows or a Windows emulator PPS. I'm not really trying to compare them, just pointing out that obsessive idea to run Photoshop in browser is almost as old as browser and photoshop themselves. And so is the idea for a grand platform that will let us "write once, run everywhere". Uncountable attempts were made, yet somehow they all fall short of expectations. Is the idea itself flawed? Perhaps we have different operating systems for a reason?..
- eliben 13y agoThe comparison to Active X, while intriguing, is really a Mu since the two are so different (http://eli.thegreenplace.net/2012/11/10/native-client-vs-activex/ http://eli.thegreenplace.net/2012/11/10/native-client-vs-act...)
- afsina 13y agoConsider this as a much safer Multi-OS native application development platform that happens to work in a browser and all (ok, most of) your fears will disappear.
- pvnick 13y agoI agree, that's the thought I've had ever since learning of native client. These native, proprietary solutions have come and gone, such will be the fate of NaCl. As far as I'm concerned the future of high-performance webbrowser computing will be javascript-based through projects like asm.js or remote cloud architectures (eg https://brendaneich.com/2013/05/today-i-saw-the-future/ https://brendaneich.com/2013/05/today-i-saw-the-future/)
- axelf 13y agoHow is this proprietary? Isnt there an open spec?
- augustl 13y agoIsn't it better to ship uncompiled C++ code directly, instead of decompiling and recompiling already compiled code? Honest question, I'm a noob at compilers :)
- mdaniel 13y agoBytecode (whether x86, Java class files or this) is a far more compact and (arguably) more complete representation of the program's logic than the input source code. Also, you haven't experienced pain until you've tried to compile C or C++ on a machine other than the author's.
- cek 13y agoWhen this is supported natively in Safari on iOS it will be interesting.
- eliben 13y agoWhy only then?
- misuba 13y agoApple's developer guidelines prohibit compiling and running anything that came over the wire, for security reasons as well as competitive ones. They could add this ability to Safari themselves, but why would they?
- _prometheus 13y agoWhat do you think will be the evolution here? Surely mobile won't stay behind native-webapps forever, at some point asm.js/pnacl/something else will come in. But what?
- misuba 13y agoI'll be interested to see how pepper.js performs on mobile. Certainly plenty of people have skin in the game and want to see this stuff work.
- drdaeman 13y agoFor the same reasons, Safari has JavaScript support, I presume.
- eonil 13y agoI think it's just a sarcasm.
- smegel 13y agoHow is this different to Javascript? They both get jitted to native code (v8, llvm)...what's the benefit?
- trentmb 13y ago> what's the benefit? I don't have to write JavaScript.
- trothamel 13y agoIt also adds the ability to have, for example, multi-threaded code. That's especially nice when it lets you avoid having to port old code from threads to an event-driven model.
- ahomescu1 13y agoPNaCl bitcode is (mostly) statically-typed and has a C-like memory model, as opposed to dynamically-typed JavaScript. Dynamic typing has a run-time performance cost, and so does garbage collection.
- eru 13y agoAre you sure that PNaCl bitcode is typed at all?
- ahomescu1 13y agoIt's kind-of typed. They kept the basic integer and floating-point types from LLVM (i8, i32, i64, double) and pointers, but removed structures and arrays. It's "more typed" than JavaScript, but less than C++. This still means that numeric code (working with integers and floats) is going to be at least an order of magnitude faster than on JS.
- deleted 13y ago[deleted]
- Fr0styMatt 13y agoWhy do people keep saying that PNaCL is like ActiveX, when it's nothing of the sort? Is this a failing on Google's PR?
- BitMastro 13y agoBecause lots of people are narrow minded apparently
- pritambaral 13y agoOne thing I am concerned about is, since PNaCl is essentially yet another platform, how Google (or anyone) is going to manage the host of supporting tools required. Tools like dependency management, libraries, process control etc. By the way, Google has already proven their "platform-creation" skills with Android.
- ThinkEzy 13y agoI am actually looking at saying good bye to browser (html / css / js and all the madness) and hello to apps that connect to dropbox or s3 or some such cheep server.
- ThinkEzy 13y agoI am actually looking at saying good bye to browser (html / css / js and all the madness) and hello to apps that connect to dropbox or s3 or some such cheep server.