iPhone Javascript and spec benchmark

So after quickly posting my video blog about answering some of the questions, I was contacted by morfik to help answer some of their iPhone questions. It turns out their doing development for the iPhone and are located across the world in Australia, but have NO IPHONE! So I emailed them and skyped a bit and we started to do some benchmarks for the iPhone.

Its kinda funny because it did not even cross my mind that people would be checking out my youtube videos and not be able to pickup a iPhone at an apple or at&t store. I guess I need to think more globally and feel bad for all those people who CANT get an iPHONE. Anyway, I continued with more testing and wanted to post up my results for the world viewing. Please also feel free to contact me with other test you are interested in or comments, I can always throw up another video blog post to show you more aspects of the iPhone.

Anyway, I did some javascript benchmarks for my 8GB iPhone as well as with my ultra fast Macbook Pro 2.4 GHz Intel Core 2 Duo with 4 GB Ram! (Safari 3.0.2) If you are looking for some javascript benchmarks for the iPhone here they are below:

I ran each of the following test from http://www.geocities.com/SiliconValley/7116/jv_bench.html on my iPhone and Macbook Pro and here are the results.

iPhone

Primes: 0.352 seconds
pgap: 8.702 seconds
sieva: 3.501 seconds
fib(20): 1.531 seconds
tak: 6.537 seconds
mb100: 24.542 seconds

Macbook Pro

Primes: 0.004 seconds
pgap: 0.074 seconds
sieva: 0.034 seconds
fib(20): 0.022 seconds
tak: 0.082 seconds
mb100: 0.34 seconds

The next tests for my iPhone and Macbook Pro took place at http://celtickane.com/projects/jsspeed.php

iPhone

Try/Catch with errors 378
Layer movement 3078
Random number engine (Did not compute)
Math engine 3474
DOM speed Testing… (998/1000)
Array functions 1739
String functions 535
Ajax declaration 1089
Total Duration
10293 ms

Macbook Pro

Try/Catch with errors 5
Layer movement 33
Random number engine 28
Math engine 43
DOM speed 21
Array functions 10
String functions 11
Ajax declaration 8
Total Duration 159 ms

*sidenote* At this point I did some development and/or Testing on iPhone … So I did some quick testing with some ruby on rails development. I opened a project I am working on and had it running localhost:3000 on my macbook pro. I jumped on the wifi network with my iPhone, open the ip of my macbook pro and bam, saw the project. So YES you can do web development on your machine and easily refresh your iPhone to view your work from any device, pretty simple all web based. (Start your development now!)

And the testing continues, I checked out http://www.quirksmode.org/dom/innerhtml.html Here are the benchmarks for javascript for the iPhone and my Macbook pro:

iPhone Benchmark

Method Time Average Time Index
w3c Dom1: 2861ms 2937ms 265
w3c Dom2: 2333ms 2339ms 211
table methods: 2423ms 2378ms 214
innerhtml 1: 1253ms 1204ms 108
innhtml 2: 1117ms 1110ms 100

Macbook Benchmark

Method Time Average Time Index
w3c Dom1: 45ms 44ms 232
w3c Dom2: 58ms 49ms 258
table methods: 40ms 40ms 211
innerhtml 1: 19ms 19ms 100
innhtml 2: 21ms 21ms 111

The Last and Final Test at http://wildbit.com/examples/adding_elements.html
Note: some of these test were taking a bit long on my macbook pro! (imagine that) So I just ran ONLY the the following below:

iPhone

Method Time
document.createElement() 1481
element.innerHTML Optimized 446
element.innerHTML join 1050
element.innerHTML Optimized Large 1444
element.innerHTML join Large 1852

Macbook Pro

Method Time
document.createElement() 24
element.innerHTML Optimized 5
element.innerHTML join 8
element.innerHTML Optimized Large 21
element.innerHTML join Large 27

As I said earlier if you are looking for some other test for the iPhone or have some questions please feel free to contact me and I will try to help. Also if you have more information about the Safari browser running on the iPhone please contact me. I also want to give a shout out to iPhone Dev Camp, I am not sure if I will be going, but I am hoping to at least remote in if possible, if you are in the NYC/VT/New England Area and planning to do some iPhone development, please contact me.

Thanks!

Popularity: 99% [?]

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Furl
  • Ma.gnolia
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • TailRank
  • Technorati

Other Great Blog Posts



18 Comments so far

  1. mcuadros on July 2nd, 2007

    http://celtickane.com/projects/jsspeed.php

    On my N95 with Opera Mini 4 beta: 420ms

  2. […] Murch has been running some benchmarks on both his iPhone and MacBook Pro to get a comparison […]

  3. Christian Decker on July 2nd, 2007

    This is pretty discouraging. I myself am developing some small applications for the iPhone, and guess what, living in Switzerland I can’t get my hands on an iPhone either. Anyway the benchmarks let me suspect that I’ll have to review my animation codes, because they might slow down things even further…
    Thanks alot for this insight ^^

  4. […] performance looks pretty bad, according to numbers collected by fellow New Englander John Murch. The purely client-side JS numbers seem to be about two orders […]

  5. […] iPhone Javascript and spec benchmark […]

  6. […] Murch has been running some benchmarks on both his iPhone and MacBook Pro to get a comparison […]

  7. mike kidder on July 3rd, 2007

    OK. either Safari is skipping some tests or it really is that fast. Safari on Windows XP is averaging approx 250ms on my laptop - Dell Latitude D810, IE was around 1200ms. Pretty fast if accurate.

  8. Casey on July 3rd, 2007

    A friend and I did our own testing and found something very interesting.

    A call to a no-op function is taking an abnormally large amount of time. Something like 75ms for 1000 of them where in a desktop browser it’s taking around 1ms. We had a bunch of other tests centered around mootools and the canvas tag that all came out fairly equally slow and the guess is that there is just some global overhead to function calls that’s accounting for the general slowness rather than problems with particular API’s (whose core functionality seems quite fast for a small device when you subtract out the appropriate function overhead).

    You can run the tests here: http://lowtidegames.com/test/shapesonly.html (note: it does send the results to our server for easily getting the results off the iPhone).

    A sample iPhone run:

    no-op took 0 milliseconds.
    get context took 1 milliseconds.
    canvas bunch took 11 milliseconds.
    100 times empty loop took 2 milliseconds.
    1000 times empty loop with nothing() took 74 milliseconds.
    set fillStyle 100 times took 88 milliseconds.
    set strokeStyle 100 times took 93 milliseconds.
    100 strokes of 20px took 63 milliseconds.
    100 10×10 fillRects took 38 milliseconds.
    100 25 radius triangles stroked took 179 milliseconds.
    100 25 radius triangles filled took 180 milliseconds.
    100 25 radius triangles stroked with style each time took 277 milliseconds.
    100 25 radius triangles filled with style each time took 271 milliseconds.
    100 strokes of 10px with style each time took 78 milliseconds.
    100 5×5 fillRects with style each time took 124 milliseconds.
    line math 10000 times took 1456 milliseconds.

  9. […] JohnMuch.com posted some Javascript benchmarks of the 8GB iPhone compared to his 2.4GHz Intel Core 2 Duo with 4GB of RAM. He ran a number of different online benchmarks including JSSpeed: […]

  10. […] It also seems the iPhone on the web is painfully slow. […]

  11. zAk on July 17th, 2007

    Hi, I’ve been searching everywere and have been unable to find the ram specs for the iphone…

    My educated guess would be a stick of 512 ddr2 or something similar, but alas, i havent been able to confirm this.

    I also had a hunch that the phone shares its 4 or 8gb of flash for the ram.

    Anyone know for sure?

  12. […] Murch has been running some benchmarks on both his iPhone and MacBook Pro to get a comparison […]

  13. val on July 25th, 2007

    I don’t understand the purpose of this test!
    Of course code running on an 700-800 MHz processor will be slower
    than an intel 2.4ghz duo core processor.

    So what sense

  14. piprog on July 31st, 2007

    Val: 800 x 3 = 2.400, but here we are witnessing not 3x, but 50x (5000%) differences!!! This will kill iPhone as a platform, unless we go back to server side processing (i.e. pre-RIA/AJAX).

  15. […] 128MB of DRAM and somewhere between a 400 to 600 MHz processor. It is somewhere between 10x-100x slower on scripting benchmarks than a new MacBook Pro and somewhere between 3-5x slower than an old T40 […]

  16. Get Firefox Now » Mobile Firefox on October 21st, 2007

    […] 128MB of DRAM and somewhere between a 400 to 600 MHz processor. It is somewhere between 10x-100x slower on scripting benchmarks than a new MacBook Pro and somewhere between 3-5x slower than an old T40 […]

  17. […] loves me… Again.A Disposable Laptop YOU MUST BUY!Get an iPhone Today!iPhone Javascript and spec benchmarkWake the F#&$ UP Coporate America!Face to Face with Tim FerrissLeopard OS X ReviewMeeting Tim […]

  18. Aaron on March 18th, 2008

    Try out the new version of Safari released today. The results from that Javascript benchmark page were bested by my 2.16GHz Core 2 Duo iMac with 3GB RAM.

Leave a Reply