Tag Archives: javascript

Slow JavaScript on Apple iPad?

Charlie Wood reports that his MacBook Pro is 26.7 times faster than his iPad at the SunSpider JavaScript benchmark.

I thought it would be interesting to put the iPad up against something more comparable, the Atom-powered Toshiba NB300 Netbook I’ve been using and enjoying for the last few weeks. I installed Safari and ran SunSpider, running on batteries. The result: the Toshiba is 4.52 times faster.

TEST                   COMPARISON            FROM                 TO             DETAILS

=====================================================================

** TOTAL **: 4.52x as fast 10999.0ms +/- 0.7% 2434.6ms +/- 4.7% significant

A lot slower than the MacBook Pro of course. Still, the iPad starts at $499. The NB300 is around $325.00 – though lacking that lovely touch screen. By way of compensation, it has a rather good keyboard, on which I am typing this post.

Note: I do not yet have an iPad so I’m relying on Wood’s test.

Why programmers should study Microsoft’s random failure and not trust Google search

The bizarre story of the EU-mandated Windows browser choice screen took an unexpected twist recently when it was noticed that the order of the browsers was not truly random.

image

IBM’s Rob Weir was not the first to spot the problem, but did a great job in writing it up, both when initially observed and after it was fixed by Microsoft.

It was an algorithm error, a piece of code that did not return the results the programmer intended.

Unless Microsoft chooses to tell us, there is no way to tell how the error happened. However, as Weir and others observe, it may be significant that a Google search for something like Javascript random sort immediately gets you sample code that has the same error. Further, the error is not immediately obvious, making it particularly dangerous.

I am sure I am not the only person to turn to Google when confronted with some programming task that requires some research. In general, it is a great resource; and Google’s own algorithms help a little with filtering the results so that sites with better reputation or more inbound links come higher in the results.

Still, what this case illustrates – though accepting again that we do not know how the error occurred in this instance – is that pasting code from a Google search into your project without fully understanding and testing it does not always work. Subtle bugs like this one, which may go unnoticed for a long time, can have severe consequences. Randomisation is used in security code, for example.

As an aside, there also seems to be some randomness in the appearance of the browser choice screen. It turned up on my laptop, but not on my desktop, although both have IE as the default.

And who would have guessed that the EU would arrange for so many of us to get an ad for something like the GreenBrowser popping up on our desktop? Apparently it is the “best choice of flexible and powerful green web browser”, though since it is based on IE it is less radical a choice than it first seems.

image