Skip to main content

Posts

Showing posts from 2010

64-bit Browser Performance

A complaint I've had with Flash lately is its lack of 64-bit support for Windows. This forces us to run 32-bit browsers on our 64-bit machines if we intend on having Flash support while browsing. My initial thought was that we're missing out on a very nice performance boost because of this. I then questioned just how sure I really was that this performance boost really existed. Thus, I decided to do some really simple testing between some 32 and 64 bit browsers just to see what happens. The results were, interesting, though not necessarily conclusive of much.

The plan is simple. Run a small JS script that will calculate all prime numbers from 1 to 10,000 and record the time taken for the operation. The end code uses a modified algorithm that I stole from the Web Workers Wikipedia page.
varn=1;varholder=document.getElementById('holder');varstartTime=(newDate).valueOf();search:while(n<10000){n++;varnSqrt=Math.sqrt(n);for(vari=2;i<=nSqrt;i++)if(n%i==0)continue…

Function Expression Scoping in IE

Ran across a somewhat unfortunate glitch in IE's handling of JavaScript recently. I've wanted to get in the habit of naming my function expressions as of late. The sole reason being so that when I have to debug, the call stack will actually show something useful rather than just "Anonymous Function" all the way down. Regarding function expression names, this is what the ECMA-262 docs state in 13:The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function to call itself recursively. However, unlike in a FunctionDeclaration, the Identifier in a FunctionExpression cannot be referenced from and does not affect the scope enclosing the FunctionExpression.So, given the following code snippet:functionsomeClass(){}someClass.prototype={};someClass.prototype.someMethod=functionsomeMethod(){alert('Hi');};someMethod();We should receive an error as someMethod should not be defined as a global funct…