Status: Accepted
Owner: [email protected]
CC: [email protected]
Labels: Type-FeatureRequest Priority-Medium

New issue 2079 by [email protected]: Speed up calls to known local functions
http://code.google.com/p/v8/issues/detail?id=2079

Currently they are 30% slower:

function global_fib (n) {
  // Will use load-global-cell, check-function, call-known-global, which
  // translates to direct call.
  return (n <= 2) ? 1 : global_fib(n - 2) + global_fib(n - 1);
}

var local_fib = (function () {
  function local_fib (n) {
    // Will use load-context-slot, call-function, which translates
    // to call through CallFunction stub.
    return (n <= 2) ? 1 : local_fib(n - 2) + local_fib(n - 1);
  }

  return local_fib;
})();

var K = 20;
var N = 35;

function t(f) {
  var start = Date.now();
  for (var i = 0; i < K; i++) f(N);
  return Date.now() - start;
}

print(t(global_fib));
print(t(local_fib));

% out/ia32.release/d8 known-local.js 2523
3712

Simple analysis at the parser level should tell use which local functions are actually constants.


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to