DaringFireball recently posted his thoughts as to why the Javascript performance of Mobile Safari is faster than those launched from SpringBoard or within existing applications which use a UIWebView. I don't think it's quite that complicated.
My thoughts are it is one of two things:
- Apple is concerned about security (which would support John's theory)
- Mobile Safari is binding to a newer and/or private version of Webkit, and Springboard was an oversight
- Apple is concerned about breaking existing applications
- I would argue this makes the most sense, and was probably a very deliberate action by Apple, given enabling Nitro is a significant enough change to a core framework that could break existing applications.
- Perhaps a future update will allow developers to opt-in to the faster Javascript engine either via a plist setting or more likely, a new API on the UIWebView class.
- Would also explain the oversight in Springboard, if it was not opted in.
There are other implications for allowing 3rd parties to use Nitro, most importantly battery life. If Javascript executes up to 3x faster, the CPU is running 3x less to to execute equivalent Javascript, allowing the CPU to go to low power mode faster.
Gruber also makes the following statement:
Apple, as of iOS 4.3, trusts Mobile Safari enough to allow this. The upside is that Mobile Safari is now significantly faster. The downside is that any security exploits against Mobile Safari now potentially allow worse things to happen than before.
I would disagree, as many of the previous Jailbreak exploits in iOS such as this example were via Mobile Safari, without a JIT engine, simply exploiting the stack and other typical attacks to elevate privileges. As Apple continues to get a handle on these security issues, running dynamic code shouldn't be a problem.