Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am surprised at just how much faster the iPhone is than the next nearest Google device (a laptop). I haven't used an Android device for a long time, but I hear the "Apple is overpriced" so often that I assume someone has been checking this out.


Actually this is probably thanks to Safari's JS engine. From the graph [1] it seems that Safari is roughly 3x faster than Chrome parsing and compiling JS code on the same Macbook Pro.

[1] https://cdn-images-1.medium.com/max/2000/1*dnhO1M_zlmAhvtQY_...


Yeah, Safari has stupidly fast startup times compared to Chrome. It's one of the big things that they are working on in their engine.

It's been a bit, and I'm going from memory here, so forgive me if i'm wrong, but...

V8 is introducing a new "interpreter" mode to help here so that the page can start being interpreted ASAP and no JIT overhead needs to force the system to wait until it's done a first pass. And in the long run they want to pull out 2 of the JITs in their engine to simplify the process and speed up the first execution (along with reducing memory usage, and simplifying the codebase to allow for faster and easier additions and optimizations).

It's a great move, but it means that things are going to get slightly worse before they get better.

The "old" V8 had 3 compilers, "Fullcodegen", "crankshaft", and "turbofan" [0]. The current V8 has those 3 + Ignition [1], so it's just adding more on now. But over time they will be removing crankshaft and fullcodegen and it will leave them with a really clean and fast engine [2].

If anyone is interested, [3] is a fantastic talk on this and other plans they have for V8, and it's very accessible for those who don't know a thing about JS engines.

(sorry about the links to google sheets here, it's the only place I can seem to find the infographics)

[0] https://docs.google.com/presentation/d/1OqjVqRhtwlKeKfvMdX6H...

[1] https://docs.google.com/presentation/d/1OqjVqRhtwlKeKfvMdX6H...

[2] https://docs.google.com/presentation/d/1OqjVqRhtwlKeKfvMdX6H...

[3] https://youtu.be/r5OWCtuKiAk

edit: Removed comment about edge, it was more assumption than anything.


Great summary with a few nits!

I am not aware that Edge is "stupidly fast" on startup. Safari though, is indeed currently leading the field.

As you correctly outlined, V8 is indeed transitioning to a world with an interpreter+optimizing compiler only. If you are using Chrome Canary, there is a chance that you are already using the new pipeline :-).

Full disclosure: I work on the V8 team.


> As you correctly outlined, V8 is indeed transitioning to a world with an interpreter+optimizing compiler only.

ECL and CLISP both settled on this model. CLISP started out as a bytecode interpreter and added GNU Lightning for native code generation. ECL started out as a source-to-source compiler to C and added a bytecode interpreter; both follow C calling convention as much as possible, at first for easy interop with C code and then for easy interop for the bytecode interpreter, which avoids the C++ interop problems mentioned in the talk.


From those who spoke at BlinkOn about Ignition, it sounded like some of the pushback had been about Octane, but there'd been some movement against worrying about the Octane regression from a view that Crankshaft was over-fitted to Octane.

How much of what's remaining is performance versus stability/correctness?


I gotta be honest, I've only heard that in comments and "not so reliable" sources, so I should probably remove it while I can.

As for the Ignition+TurboFan setup, are you really that far along already?

Last I heard a few months ago it still sounded like it was gonna be a while before TurboFan was fast enough in most cases to be able to handle it.

If so that's awesome!


It is progressing quite nicely. We still don't know yet when it is ready to graduate from Canary/Dev though. Lot's of stuff to do!


iPhones aren't simply faster at JS, they're faster at everything. Benchmarks run in the same app always come out drastically in the iPhone's favour.

Granted, this isn't a strict apples-to-apples comparison, but the differences are so drastic and always in Apple's favour. That, combined with the actual, physical differences in speed of the processors on the phone itself, indicates that it's not just Safari.


It helps that they chose an AOT model, with languages that support value types.

Also that even the bitcode model is compiled at the store, instead of frying eggs on the device.

Doing real-time audio applications on Android is a pain, from the presentations I have watched, even with the NDK.


Its a combination of that and Apple's A10 chip being significantly faster than the top Qualcom chips at single thread: http://www.tomsguide.com/us/iphone-7-benchmark-results,news-...


The A10 doesn't come into this, it just makes it even faster. An iPhone 6 is substantially faster in the graph shown than any current Android phone.


JavaScript performance on Android have been lagging behind iOS for years now. (https://meta.discourse.org/t/the-state-of-javascript-on-andr...)


Yeah, and that's becoming quite an old thread (2015), yet the most recent comment is from Nov 2016, and if you read backwards from there it's a pretty strong indicator that the issues are still extant. It's a real PITA. My soon to be replaced (but I like the small form factor a lot) iPhone 5S from 2013 whups the ass off my OnePlus Two from early 2016 when it comes to JS and canvas rendering performance.


I've been a mac user for a few years and this year switched back to iPhone as well. I figure if JS developers don't want to address the speed issue[0], I might as well invest in a company that will.

[0] They are always too busy saying, "Just use React".


Apple have actually put effort into improving single-threaded performance. Whereas competing Android handset manufacturers have wasted effort on a internecine MOAR CORES = BETTER!!! marketing fight.


yes indeed. It looks like the iphone 7's time is around 150ms (Safari), whereas my galaxy s7 takes well over a full second (Chrome).


You should use Samsung internet. Much faster and smoother than chrome. Also supports ad blockers and has a nifty reading mode.


Would a few milli second or few seconds be worth it by paying like 3 or 4 times to a low end android mobile?


That honestly isn't the reason I got an iPhone, but you raise an excellent point: for a 600x improvement in speed, and less advertising, one only has to pay 4x the price.


If you compare like that then it takes ages to load the initial page itself. 4x price is not worth then.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: