Ben Matasar

I'm Ben. I work at Twitter, on Vote Track OR and the Bus Project. Follow me on Twitter, if you like.

V8 has more turtles on the way down.

I think V8 is the most exciting of the JS engines in development, partly because of the team behind it in Denmark but also because it passes an important test.

V8 version 1.1.6
> [1,2,3].map
function map(f, receiver) {
  if (!(typeof(f) === 'function')) {
    throw MakeTypeError('called_non_callable', [ f ]);
  }
  var length = this.length;
  var result = new $Array(length);
  for (var i = 0; i < length; i++) {
    var current = this[i];
    if (!(typeof(current) === 'undefined') || i in this) {
      result[i] = f.call(receiver, current, i, this);
    }
  }
  return result;
}

And, with SpiderMonkey (using a REPL for couchdb Lennon and I hacked together on Friday):

js> [1,2,3].map
function map() {
    [native code]
}

Source for the CouchDB repl is on github.

Comments (View)
blog comments powered by Disqus