Apple's FTLJIT project aims to give JavaScript a boost
infoworld.com
infoworld.com
I think there is a lot of hyperbole around the whole JIT in webview thing from people who don't have a good grasp of where the performance problems are on mobile web.
Take a 3D matrix transform for example. It needs to be marshalled from an array of floats to a string to be applied. Then it needs to be parsed back into an array of floats to be used to position a texture in the GPU. Such a huge waste...
[1] it's already in iOS since v4, but only activated for iAds
See: http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-...
(I suspect there are some constraints on how a remote view controller can be used, and they'd have to do some additional work to shunt in NSURLProtocol and all.)
WebKit2 is done differently. The UIWebView still handles all the user interaction and whatnot, and it talks to the Web Process to send it requests (e.g. "load this URL", "run this JavaScript in the context of the page", etc). I'm not quite sure how the compositing of the web content works, but it's not the same system as remote view controllers.
http://oleb.net/blog/2012/10/more-on-remote-view-controllers...
https://github.com/nst/iOS-Runtime-Headers/blob/master/Frame... https://github.com/nst/iOS-Runtime-Headers/blob/master/Frame...
However, I have no idea if there are enough hybrid apps out there, with javascript performance issues, to justify going to the trouble of doing this.
WebKit2 is an existing effort by Apple to do out-of-process rendering. Various desktop apps already use it, including Safari, Mail, and iBooks. It features new APIs for doing everything, because it's all asynchronous. If third-party iOS apps gain out-of-process rendering it will be through WebKit2 and not some attempt to port UIWebView to the remote view controller system.
Incidentally, the same synchronous issues with UIWebView that I mentioned above suggest that porting to WebKit2 is a non-backwards-compatible change. If Apple makes this change, I would guess that either they'll introduce a separate UIWebView class that's used for WebKit2 and leave the existing UIWebView alone, or they'll give UIWebView two modes, a WebKit mode and a WebKit2 mode, and whichever mode it uses will be selected at initialization time (and using a WebKit method on a WebKit2 UIWebView would be an error, and vice versa). Either way, apps will have to be rewritten to take advantage of WebKit2.
Also, apple has changed the internal subviews of system views before. In some cases they seem to provide a backwards compatible subview layout mode triggered by looking at the compiler/linker/sdk version so existing binaries will keep running. For sure I have seen previously working code like this breaking merely by recompiling with a newer xcode, as if it is taken to be an opt-in to new internal layouts - but not always; sometimes even existing apps needs rush updates if they have been assuming too much about undocumented subview hierarchies.
Because it's blocking the main thread. Worse, it's blocking the main thread doing something that has effectively no upper bound on how long it can take. Web Process is blocked trying to handle a previous request to calculate Pi to a trillion digits in javascript? Oops, your synchronous call to execute more javascript will just have to wait. Indefinitely.
> Also, apple has changed the internal subviews of system views before.
I'm not talking about internals. UIWebView directly exposes its scrollView as public API. And you can muck with the view properties of the UIWebView too to make changes. For example, if you really want to you could set your UIWebView to 50% alpha (and this is totally legit, not depending on internal subview hierarchies). Whereas Remote View Controllers explicitly prevent you from mucking with any aspect of the view hierarchy.
Fair enough about the scrollviews, although maybe they could be proxied somehow.
So may be we get Webkit2 for iOS 8?
So hopefully, they will come in iOS8.
What Apple does on iOS goes beyond W^X. They give you a one-way trap door, where you're not allowed to mark any memory as executable, ever, once it's marked non-executable. (Obviously, there is an exception made for the OS facilities that actually load your code from the disk, and an exception made for Safari's JIT, but us mere mortals don't get access to that stuff.)
As for the reason, it's hard to say. It's probably because of code signing and Apple's desire for control to prevent you from downloading and running unreviewed, unapproved code, although even that doesn't entirely make sense, because you can always embed an interpreter and download and run code in that.
Any secure JIT would have to exist out-of-process with extended permissions, and would require some sort of RPC back-and-forth as the code was shuttled between the two processes.
One can debate the security implications of allowing programs to mark code as executable at all, but that debate is unrelated to W^X.
1. Preventing any app code from allocating memory and setting it executable: Apple doesn't seem to want to allow dynamically adding code to any app store apps. See: No .dylib support, the earlier bans on all types of interpreters, etc. It would be too easy to get a "Loader"-type app into the app store that could download and execute random app code from the internet that hasn't been vetted by the app store review team. (Emulators, plugins, addons that call private APIs, etc. etc. etc.)
2. Limiting the vulnerability surface: Reduce the risk of webkit exploits targeting app store apps (or even non-webkit random exploits in the app's code allowing loading of shellcode)
[1] http://www.cnet.com/news/mozilla-says-no-plans-to-return-to-...
[2] http://thenextweb.com/apple/2013/04/04/will-chrome-for-ios-b...
Apple's case, if I understand, is different, because you cannot generate code at runtime and hence you cannot compile something "just in time". Nothing about Firefox OS disallows this, and so the two situations are not comparable
Firefox OS is providing the same thing. They don't allow you to just replace the OS, which in this case is the browser, but all applications, including their own are written with the same APIs available to you the developer. They aren't writing some of their own apps in C++ and then demanding everyone else write in Javascript. Apple is writing their own JIT and then demanding that everyone else interpret, which is not at all equivalent.
The difference here is that the browser is the OS. So the OS is at a certain level which you cannot replace or step into willy nilly. Think of it like Windows enforcing Hardware access through its drivers, not allowing you to just send whatever you want to someone's disk drive and possibly do damage to the device. In the same way, they enforce a level of Memory protection through the runtime, and after that they are on the same footing as you. We accept these constraints when we run OSs all the time, and I don't see it as being much different here.
So, while Google could probably build Chrome out of Javascript and run it atop the Firefox OS engine, it wouldn't make sense to do so. Asking if you can is basically like asking if you can create Chrome as a Firefox extension on Windows. Sure, you probably could with enough effort, but it would be a bit pointless in terms of functionality, speed, practicality, etc.
Additionally, this is a bit of a straw man that Apple fans trot out when people accuse Apple of being anti-competitive with iOS. It's not an equivalent situation. An equivalent situation would be if Google forbid other browser engines from running on Android. But, they don't. So, we have a nice competitive browser ecosystem on Android with solid browsers like Firefox that I use every day.
In fact I far prefer companies serve me the full desktop site.
As for preferring the desktop sites, I'm afraid you are in a minority there.
If all the device manufacturers come together tomorrow and propose a cross-platform native programming platform then I'm all for it. Until then we'll rely on HTML.
That is, developing for the web doesn't magically make these fragmentation issues you attribute to native development disappear. The cost is lower because the quality expectations are lower, both in terms of the end-product and the developers putting the product together.
Put another way, if browsers become sophisticated enough to make them an appropriate medium for native-like apps that are more sophisticated than basic form data entry, what makes you think the cost to find competent, quality developers to write these apps to the level of quality expectation the end users will have won't be higher than it is today?
We use apps like Photoshop, Word, Logic, Lightroom etc and not once has anyone come close to replicating the full experience within a web browser. Performance was never an issue then so why do people believe that once mobile browsers are faster that magically native apps will disappear ?
I'm not sure that I've seen anyone suggest that. In any case, your point assumes that every app has the level of complexity that Photoshop, Lightroom etc. do and that's clearly not the case.
The simple fact remains that mobile web performance is sub-par, so every mobile web experience you've seen so far has also been sub-par. That doesn't automatically mean that amazing mobile web performance will result in amazing mobile web apps, but without trying it we won't ever know.
Everyone who uses Gmail and/or Google Docs is "detached from reality"?
Okay.
As a consequence, performance of JS outside of Safari is notably poor, and developers choose to go the "native" route for the sake of user experience.
My point is that we can do better. Tossing WebGL into the mix wouldn't hurt.
Why is no one up in arms about Apple doing essentially the same thing with Safari vs. UIWebView?
It's not like it's not the fastest web view widget among mobile operating systems already.
Citation needed? Safari's had a JIT JavaScript engine since 2008, and was one of the first (if I remember correctly). This is just a new version again.
Indeed, Safari has had JITed JS for longer than most browsers - this is just an update.
Is this a joke? IndexedDB, WebRTC, etc.?
For those who aren't familiar with the problem, say you've written a cool web app that creates (just for example) ZIP files. You want to let the user save these to disk. In Chrome, Firefox, or Opera, this is dirt-simple. Put the ZIP data in a data URL, set the href attribute of the link to the data URL, and set the download attribute to "yourcoolfilename.zip" (or whatever you want). Boom. Done. User clicks the link, data downloads to "yourcoolfilename.zip". Totally streamlined.
Not in Safari. The best you can do there is open up the data URL in a new window (which of course ignores any mime type you've set, so the user gets an ugly screen full of binary data) and tell them to use Save As to save the mess. Very nasty.
Chrome has had this feature for 20 (!) versions, Firefox for 9, Opera for 5. It even works on the Android and Blackberry browsers.
Even IE allows this (in a completely non-standard and convoluted way, naturally, but it can be done).
You make it sound like this downloading ZIP and other files aren't possible on Safari.
Which is true.
Edit: a simple illustration of the problem.
IOW, they aren't far off each other. Safari suffers from a much slower release cycle in particular - Chrome is usually a few features ahead due to this. Same with Firefox.
Worst browser for who? Developers or actual users?
As a dev, I don't prefer using Safari to build stuff, that's for sure. Chrome and sometimes even Firefox is much more pleasant in that regard.
But as a user, the overall browsing experience is usually quite good. There are three things that it does really well IMO.
* It renders text and websites beautifully. * I don't care so much about artificial benchmarks - Safari usually feels like one of the faster browsers in normal usage and for things like switching between tabs and all of that normal stuff. * It takes advantage of some newer OS X technologies for extending battery life.
The only missing ingredient as a user is the much smaller extension ecosystem for Safari.
The world would be a poorer place if we had fewer independent implementations, as each has its own design and architecture.
So, what if this led to a bytecode derived from LLVM IR becoming a universal bytecode for the web?