In a place where your fantasy can roam free, there won't be any boundaries to what your imagination can create.
Misha’s Tech Playground
graphics, fun and code play
I'm crazy - but who cares? My ideas are constantly dwelling and this is the place for them to pour out and form into something good. Only active participation will ultimately make this place come to life.
Safari wins , Opera lost (real life JS performance)
To check performance on large maps in my level editor I included a little function that generates a map of a given size filled with random tiles. I am lazy I know, but try to click your way through a 200 x 200 (40000 tiles) map and you know what I am talking about
So while testing I found out that there are vast performance differences between the various browsers on my system[1]. I also rectified en Error with Event handling in Opera 9.5* while I was at it.
The test I ran was pretty simple, I used all three browsers to create a random 100 x 100 map and took the time before the function started and after it finished. The difference was output in an alert which you see here.
It’s easy to notice that Safari 3 on OS X has a huge advantage over competing browsers.
Safari 3 is best
Firefox 3 beta is a distant second
Opera 9.5 beta is 3rd
[1] All tests were conducted using a MacBook Pro (1st Gen.) 17″ 2.16 GHz, 1GB Ram, OS X 10.4.11. The window size was set to exactly 720×600 pixels using JavaScript.
If you wish to support me testing on Microsoft Windows, feel free to leave a message.
*It seems Opera can’t handle click Events attached with an addEventListener Method to List Items. Instead I had to use element.onclick = callBack; instead to get it work.
Addendum
As expected, the big delay occurs in the dom accessing while building the map. After changing the function to only create the tile and image objects without appending them to the dom tree all Browsers were considerably faster.
Safari ran at times around 2.2 seconds and Firefox 3 beta at about 6.6 seconds. The first test with Opera 9.5 beta showed 9.75 seconds, though a subsequent check went up to over 50 seconds(!)[2], another test even went up to over 2 minutes… It seems that either there is a memory leak in my script or the current beta has certain problems in the JavaScript interpreter. Though I think the latter is more likely.
[2] Opera’s odd performance with dom functions turned off
Tags: code performance, Firefox, Opera, Safari
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Leave a Reply