{"id":744,"date":"2008-03-19T10:51:00","date_gmt":"2008-03-19T17:51:00","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/2008\/03\/19\/new-safaris-javascript-engine-kicks-ass\/"},"modified":"2008-03-19T10:51:00","modified_gmt":"2008-03-19T17:51:00","slug":"new-safaris-javascript-engine-kicks-ass","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/new-safaris-javascript-engine-kicks-ass\/","title":{"rendered":"New Safari&#8217;s JavaScript engine Kicks Ass!"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/farm3.static.flickr.com\/2094\/2345178853_2f0af7ce85.jpg?w=640\" align=\"right\" style=\"margin:10px\"\/>So I downloaded yesterday the latest Software Update for Mac OSX and it included an update of the Safari Web Browser, which I had taken for dead ages ago, I&#8217;m a hardcore Firefox user.<\/p>\n<p>Today I read about the new updates, and I read something that caught my eye at <a href=\"http:\/\/www.mackinando.com\">Mackinando.com<\/a>.<\/p>\n<blockquote><p>it executes JavaScript six times faster than the rest<\/p><\/blockquote>\n<p>I go to the Safari Site, and they compare themselves with a previous version, Firefox, and Opera (not IE, not even worth mentioning)<\/p>\n<p>I couldn&#8217;t believe my eyes, so I googled for &#8220;<a href=\"http:\/\/www.google.com\/search?client=safari&#038;rls=en&#038;q=Javascript+benchmark&#038;ie=UTF-8&#038;oe=UTF-8\">JavaScript Benchmark<\/a>&#8220;, and tried the <a href=\"http:\/\/webkit.org\/perf\/sunspider-0.9\/sunspider.html\">SunSpider JavaScript Benchmark<\/a> onboth Firefox 2.0.0.12 and the shiny new Safari 3.1.<\/p>\n<p><center><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/farm3.static.flickr.com\/2174\/2345121485_4a81e90d19.jpg?w=640\"\/><\/center><\/p>\n<p>The machine used for this test is a MacBook Pro running Mac OS X Version 10.4.11 with a 2.33 GHz Intel Core 2 Duo and 2GB 667 MHz DDR2 SDRAM.<\/p>\n<p>Here are the results side by side:<\/p>\n<style>\npre {\nborder:none;\nfont-size:9px;\n}\n<\/style>\n<table cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td valign=\"top\">\n<pre style=\"background-color:#FFCC00; width:205px\">FIREFOX 2.0.0.12\n========================\nRESULTS \n(means and 95% confidence intervals)\n-----------------------------------------\nTotal:                 <strong>15365.4ms<\/strong> +\/- 1.7%\n-----------------------------------------\n\n  3d:                   2386.6ms +\/- 7.9%\n    cube:                733.0ms +\/- 20.8%\n    morph:              1269.8ms +\/- 9.4%\n    raytrace:            383.8ms +\/- 37.1%\n\n  access:               1386.2ms +\/- 4.8%\n    binary-trees:        201.6ms +\/- 0.6%\n    fannkuch:            294.8ms +\/- 5.4%\n    nbody:               691.2ms +\/- 8.9%\n    nsieve:              198.6ms +\/- 1.5%\n\n  bitops:               3461.2ms +\/- 0.4%\n    3bit-bits-in-byte:   275.8ms +\/- 0.6%\n    bits-in-byte:        248.2ms +\/- 0.7%\n    bitwise-and:        2765.2ms +\/- 0.5%\n    nsieve-bits:         172.0ms +\/- 4.7%\n\n  controlflow:           153.4ms +\/- 0.7%\n    recursive:           153.4ms +\/- 0.7%\n\n  crypto:                527.2ms +\/- 0.5%\n    aes:                 230.8ms +\/- 1.2%\n    md5:                 147.4ms +\/- 0.5%\n    sha1:                149.0ms +\/- 0.6%\n\n  date:                 2551.8ms +\/- 0.3%\n    format-tofte:       1449.6ms +\/- 0.3%\n    format-xparb:       1102.2ms +\/- 0.8%\n\n  math:                 1312.6ms +\/- 12.8%\n    cordic:              497.4ms +\/- 12.0%\n    partial-sums:        501.6ms +\/- 1.6%\n    spectral-norm:       313.6ms +\/- 36.1%\n\n  regexp:                501.0ms +\/- 0.2%\n    dna:                 501.0ms +\/- 0.2%\n\n  string:               3085.4ms +\/- 10.3%\n    base64:              914.6ms +\/- 3.4%\n    fasta:               676.0ms +\/- 35.4%\n    tagcloud:            441.4ms +\/- 0.6%\n    unpack-code:         846.8ms +\/- 25.4%\n    validate-input:      206.6ms +\/- 1.1%\n<\/pre>\n<\/td>\n<td valign=\"top\">\n<pre \"background-color:#888; width:205px\">SAFARI 3.1\n========================\nRESULTS \n(means and 95% confidence intervals)\n-----------------------------------------\nTotal:                 <strong>3368.8ms<\/strong> +\/- 1.0%\n-----------------------------------------\n\n  3d:                   414.8ms +\/- 1.9%\n    cube:               132.2ms +\/- 2.4%\n    morph:              144.6ms +\/- 4.1%\n    raytrace:           138.0ms +\/- 0.6%\n\n  access:               520.4ms +\/- 4.1%\n    binary-trees:        78.6ms +\/- 11.3%\n    fannkuch:           231.4ms +\/- 2.0%\n    nbody:              149.2ms +\/- 8.1%\n    nsieve:              61.2ms +\/- 3.9%\n\n  bitops:               449.6ms +\/- 2.4%\n    3bit-bits-in-byte:   69.8ms +\/- 9.6%\n    bits-in-byte:        99.2ms +\/- 4.6%\n    bitwise-and:        167.2ms +\/- 2.3%\n    nsieve-bits:        113.4ms +\/- 6.7%\n\n  controlflow:           91.2ms +\/- 4.7%\n    recursive:           91.2ms +\/- 4.7%\n\n  crypto:               247.2ms +\/- 2.3%\n    aes:                 81.2ms +\/- 2.5%\n    md5:                 83.8ms +\/- 4.6%\n    sha1:                82.2ms +\/- 2.0%\n\n  date:                 306.4ms +\/- 0.5%\n    format-tofte:       146.6ms +\/- 1.4%\n    format-xparb:       159.8ms +\/- 1.0%\n\n  math:                 454.8ms +\/- 1.3%\n    cordic:             174.4ms +\/- 1.6%\n    partial-sums:       193.8ms +\/- 1.2%\n    spectral-norm:       86.6ms +\/- 4.4%\n\n  regexp:               209.6ms +\/- 0.7%\n    dna:                209.6ms +\/- 0.7%\n\n  string:               674.8ms +\/- 2.2%\n    base64:             103.8ms +\/- 9.0%\n    fasta:              177.0ms +\/- 1.0%\n    tagcloud:           136.0ms +\/- 4.6%\n    unpack-code:        136.0ms +\/- 1.7%\n    validate-input:     122.0ms +\/- 2.6%\n<\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<p>Comparing with Firefox, the overall result of this test was that it&#8217;s 4.56 times faster.<\/p>\n<p>However, if we look test by test, there are areas where I feel embarrassed for Firefox.<\/p>\n<p><strong>Bitwise Operations<\/strong><br \/>\nFor example, Bit-Operation tests in Safari 3.1 are 7.7 times faster in Safari, being the case of the bitwise-AND (&#038;) operator the worst of them, <strong>Safari performed bitwise-and&#8217;s 16 times faster than Firefox<\/strong><\/p>\n<p>OUCH!!<\/p>\n<p><strong>String Operations<\/strong><br \/>\nSo you&#8217;d be curious now about String operations, which is probably a lot of what goes on with Javascript, and Ajax, parsing those XML results and what not, maybe the bitwise &#038; won&#8217;t hurt us that much given that not many programmers today are smart enough to use them for web programming.<\/p>\n<p>When it comes to String operations, Safari 3.1 was 4.5 times faster than Firefox 2.<\/p>\n<p>Kudos to the Safari Team, I thought there was no point in having Safari until I did this benchmark. I guess they don&#8217;t want to let go of Web Browser users, maybe they make millions every month with ad-clicks on Google generated with the search field they have at the top of the browser which is set by default to do Google search.<\/p>\n<p>Once again the saying proves it self<\/p>\n<blockquote><p>&#8220;Competition is good&#8221;<\/p><\/blockquote>\n<p>Let&#8217;s hope this will make the Firefox team think more on Javascript improvements with the upcoming Firefox 3. Once it&#8217;s release ready, it&#8217;ll be worth it running this benchmark again and see where it stands.<\/p>\n<p><strong>Update (March 20th, 2008)<\/strong><\/p>\n<p>I&#8217;ve made tests on Firefox 3 beta 4, <a href=\"http:\/\/www.gubatron.com\/blog\/2008\/03\/20\/safari-31-benchmark-part-ii-vs-firefox-30b4\/\">You can see the results here<\/a>. Tests have been made again on the same Macbook Pro. The improvements of Firefox 3 are notable, however, on the mac, Safari still wins.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I downloaded yesterday the latest Software Update for Mac OSX and it included an update of the Safari Web Browser, which I had taken for dead ages ago, I&#8217;m a hardcore Firefox user. Today I read about the new updates, and I read something that caught my eye at Mackinando.com. it executes JavaScript six [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,15,26,30,39,59],"tags":[150,188,418,585,860,925],"class_list":["post-744","post","type-post","status-publish","format-standard","hentry","category-ajax","category-code","category-free-software","category-geeklife","category-internet","category-opinions","tag-apple","tag-benchmark","tag-firefox","tag-javascript","tag-safari","tag-speed"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-c0","jetpack-related-posts":[{"id":747,"url":"https:\/\/www.gubatron.com\/blog\/safari-31-benchmark-part-ii-vs-firefox-30b4\/","url_meta":{"origin":744,"position":0},"title":"Safari 3.1 Benchmark part II &#8211; VS Firefox 3.0b4","author":"gubatron","date":"March 20, 2008","format":false,"excerpt":"This is the Part II of Benchmarks between Safari 3.1's JavaScript engine and Firefox. Last Benchmark was done against Firefox 2, and Safari destroyed Firefox's Javascript engine, in some aspects being up to 7 times faster. So I was curious and I downloaded and tried the benchmark on Firefox 3.0b4.\u2026","rel":"","context":"In &quot;AJAX&quot;","block_context":{"text":"AJAX","link":"https:\/\/www.gubatron.com\/blog\/category\/ajax\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":436,"url":"https:\/\/www.gubatron.com\/blog\/how-to-remove-elements-from-a-listbox-in-javascript-ie-and-firefox\/","url_meta":{"origin":744,"position":1},"title":"How to remove elements from a listbox in Javascript (IE and Firefox)","author":"gubatron","date":"January 11, 2007","format":false,"excerpt":"\/\/By Gubatron, just a silly function to clear the contents of a listbox object var ua = navigator.userAgent.toLowerCase(); var Browser = new Object() Browser.isIE = window.ActiveXObject ? true : false; Browser.isFirefox = (ua.indexOf(\"firefox\")!=-1); function clearListbox(listboxObject) { if (Browser.isFirefox) { \/\/in firefox \"Option\" objects remove themselves. var options = listboxObject.options while\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":352,"url":"https:\/\/www.gubatron.com\/blog\/internet-explorer-javascript-vs-firefox-ajax-error-recovery-in-firefox\/","url_meta":{"origin":744,"position":2},"title":"Internet Explorer Javascript vs Firefox: AJAX Error Recovery in Firefox","author":"gubatron","date":"August 4, 2006","format":false,"excerpt":"After a good 4 hours or more, we finally found the error, it was our bad, but Firefox was helping us, Internet Explorer was keeping the standards but not reporting a warning or recovering from our fault... We're currently using a complex ajax call that needs to pass a bunch\u2026","rel":"","context":"In &quot;AJAX&quot;","block_context":{"text":"AJAX","link":"https:\/\/www.gubatron.com\/blog\/category\/ajax\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":308,"url":"https:\/\/www.gubatron.com\/blog\/useful-firefox-extensions\/","url_meta":{"origin":744,"position":3},"title":"Useful Firefox extensions","author":"gubatron","date":"May 2, 2006","format":false,"excerpt":"Here's a page I've been meaning to do a long time ago, if you're a web developer you might want to bookmark it so that next time you set up Firefox +1.5 you'll have direct links to all the web developer tools you'll ever need. Web Developer Extension (Best extension\u2026","rel":"","context":"In &quot;Gubatron&quot;","block_context":{"text":"Gubatron","link":"https:\/\/www.gubatron.com\/blog\/category\/gubatron\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":268,"url":"https:\/\/www.gubatron.com\/blog\/firefox-16-might-include-python-interpreter-script-typetextpythondef-helloworld-script\/","url_meta":{"origin":744,"position":4},"title":"Firefox 1.6 might include Python interpreter:","author":"gubatron","date":"March 3, 2006","format":false,"excerpt":"Rumors say Google engineers are working on a branch of code that will allow embedding python code on the client side. It seems finally we won't have to deal with an Object Based language (javascript) which makes sense... Now we'll have a true Object Oriented language running on the backend\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":402,"url":"https:\/\/www.gubatron.com\/blog\/an-useful-example-on-how-to-extend-javascript\/","url_meta":{"origin":744,"position":5},"title":"An useful example on how to extend Javascript","author":"gubatron","date":"November 29, 2006","format":false,"excerpt":"Today I found out I could extend the functionality of __EXISTING__ html classes with javascript. I was manipulating DOM objects, better known as HTMLElement objects, and I needed a way to print the HTML that represents the tag of the object, not what's contained by the tags... a friend told\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=744"}],"version-history":[{"count":0,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/744\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}