Archive for the 'Optimization' Category

Performance Testing in JavaScript

Saturday, August 16th, 2008

Fast pages and quick load times are key factors to keeping visitors on your site.
If you make them wait, they will leave.
So the speed of your JavaScript applications is crucial.
Fortunately, it turns out that JavaScript applications are ripe for performance optimization.
This requires a strong testing framework… enter JSTR.
String Concatenation Performance
A simple example of the type [...]

Timing is everything

Saturday, July 19th, 2008

Here for your delight.
A simple way to track timing in Javascript.
// TIMESTAMP Function
function timestamp(){return (new Date()).valueOf();}

// TIMER Function, wraps timing arround function call
function timer(f){
  var t1 = timestamp();
  for(var i = 0; i < 1000; i++){
    f();
  }
  var t2 = timestamp();
  return t2-t1;
}

// The function to test
var testFunc = function(){
  var v = [...]

Byting the hand that feeds you…