News roundup: the performance of feature detection, Mobile Firefox 4 performance, W3C Touch Events

The performance of feature detection

Alex Russell from the Google Chrome team has ignited a debate about the performance cost of JavaScript feature detection, a very popular technique used in everything from Modernizr and has.js to YUI3, which loads JavaScript polyfills when needed (for instance, loading JSON in browsers with no native JSON support).

Alex’s first post prompted much discussion and requests for clarification (is he saying user agent sniffing is more preferable?), which resulted in a second post with numbers to back up his position, along with more clarification, where he seems to be advocating a form of user agent detection on the server-side. Which is actually what many in the mobile world have been doing for quite some time now (i.e. WURFL), simply because there was no other alternative at the time (and the devices couldn’t run JavaScript).

For a bit of a grain of salt, check out Faruk Ates’s response, cautioning against user agent sniffing.

EDIT: Also check out John-David Dalton’s two part video response arguing in favor of feature testing, based on real-world data showing what he argues to be a small performance hit.

Mobile Firefox 4 Beta performance

Mobile Firefox has been a bit of an ugly duckling on the mobile browser scene, getting little attention compared to Mobile Safari, Android, and even webOS. However, this week it proved itself to be a true dark horse by coming out of nowhere and blowing away the performance of every other mobile browser.

Arstechnica ran the SunSpider test on a Nexus One with Android 2.2 and found Mobile Firefox 4 Beta completed the test in a record 3,558ms, beating the native Android browser, which finished at 5,742ms.

On the Mozilla Blog they proudly announce the latest release, mentioning faster startup, page loads, and faster panning and zooming. They also mention the new release is about three times faster on their own Kraken benchmark, about twice as fast on SunSpider, and just a bit faster on V8 (proving once again that not all benchmarks are created equal).

Also of note is that Mobile Firefox seems to be the only mobile browser with add-on capabilities, while all the other browsers are still stuck with JavaScript bookmarklets at best.

W3C Touch Events

The W3C has just released the beginnings of the Touch Events Specification based on Apple’s specification.

This is obviously still a very rough and in-progress document, but what’s most interesting is a deviation from Apple’s spec in the introduction of touchenter and touchleave events (at the request of ppk), which are analogous to mouseenter and mouseleave originally implemented by Microsoft years back.

You can read more discussion about the spec from Doug Schepers (W3C) and ppk.

Correction

The obfuscated JavaScript that appeared in this month’s issue of JSMag (February 2011) has an error. The correct code (which needs to be escaped correctly to paste here) is as follows:

($=[$=[]][(__=!$+$)[_=-~-~-~$]+({}+$)[_/_]+($$=($_=!''+$)[_/_]+$_[+$])])()[__[_/_]+__[_+~$]+$_[_]+$$](_/_)

Which if you remember, is equivalent to alert(1).

For those really interested in unreadable code, also be sure to check out aaencode, which converts your code to Japanese style emoticons

Releases

RingoJS 0.7
jQuery Mobile Alpha 3
jQuery 1.5

Upcoming Events

JS Boot Camp (February 10-11, 2011 in Reston, Virginia, US)
High-Performance Mobile (SF Web Performance Group) (February 16, 2011 in San Francisco, CA) – a talk given by yours truly
Confoo.CA: Web Techno Conference (March 9-11, 2011 in Montreal, Canada)
MobileCampRDU (March 12, 2011 in Durham, North Carolina)
codeconf (April 9-10 in San Francisco, US)
JSConf 2011 (May 2-3, 2011 in Portland, Oregon, US)
NodeConf 2011 (May 5, 2011 in Portland, Oregon, US)
jsday (May 12-14, 2011 in Italy)
Mobilism (May 12-13, 2011 in Amsterdam)
TXJS (June 5, 2011 in Texas)

Tidbits

You can now see the most popular jsperf test cases
HTML5 canvas sprite optimisation shows you why you should round your numbers to the nearest whole number when working with canvas. Related: Iain Lobb’s BunnyMark benchmark (bunnies + performance)
Abusing HTTP Status Codes to Expose Private Information
ECMAScript 5 strict mode in Firefox 4
How to Write Maintainable OO JavaScript Code
Explaining EmbedJS
Phantom Limb
The WebKit PreloadScanner
stylus
audio.js
HTML5 Canvas 3D particles uniform distribution
The Harmony Of My Dreams
opencoweb: Cooperative Web Framework
A dash of speed, 3D and apps (Google Chrome Blog)
Game On Winners: Level Up the Open Web (Mozilla Labs)
AwesomeChartJS
An Intro to Backbone.js: Part 1 – Models and Collections
Introduction to jQuery Mobile
JSApp.US is a nice node.js hosting platform to get code up-and-running in short hack projects.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • description
  • Reddit
  • TwitThis
  • Simpy
  • StumbleUpon

2 Comments

  1. Alex Russell says:

    My posts weren’t advocating server-side UA detection, only caching, and lots of it = )

  2. Grumpy says:

    Hello jsmag team. I really *really* like following your blog but there is one major bummer with it: it seems the posts are being edited or updated every now and then, and my RSS Reader (NewsFire) always tells me there is something new, but they are older posts.

    Today this article has been flagged as New,. It says “Published: Today 12:56″. It appears at the top of my JSMAG RSS feed, so the archive of articles is all over the place. It’s really hard to follow what I had read or find my way through older articles. This type of feed with lots of link is something I “consume” over a long period of time, I might wanna come back and check more links, but in my RSS reader the archive is routinely “reordered”, with older articles moving to the top. I can’t sort them properly since the Publish date is wrong.

    There seems to be something buggy with the RSS feed, as I don’t have this problem with any of the other 40-some feeds I follow. Could you check the RSS code? Maybe it’s missing something?

    I recall sending you an email many months ago about a problem with the XML output. Could be another related error? A missing field? A last edit in place of publis htime? Something like that?

    Thank you.

Leave a Reply




© webdevpublishing 2011