John Murch

iPhone Javascript and Spec Benchmark

01 Jul 2007
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!

📣 Software Development And Life

Subscribe to My Newsletter Today! Get Awesome Insights and Inspiration on Building Ideas

I do not send a lot of email and promise I will not spam you

Also be sure to 👋 and follow me on 🐦 @johnmurch