passing custom params to callbacks (v2)

Revision 2 of this benchmark created on


Setup

var i = 0, j= 0, k= 0, l=0, m=0
    
    function bound() {
      return this
    }
    
    
    function useClojure(i) {
      return function() {
        return i
      }
    }
    
    function ownBind(func,toBind){
        return function(){
            func.apply(toBind);
        }
    }
    
    function notBound(what){
        return what
    }
    
    function passing(func, toPass){
        return function(){
            func.call(null,toPass);
        }
    }
    
    function passingW_OCall(func, toPass){
        return function(){
            func(toPass);
        }
    }

Teardown


    //alert('i='+i+' j='+j+' shared='+shared)
  

Test runner

Ready to run.

Testing in
TestOps/sec
bind
bound.bind(i++)()
ready
clojure
useClojure(j++)()
ready
own bind
ownBind(bound, k++)()
ready
passing
passing(notBound, l++)()
ready
passing without call
passingW_OCall(notBound, m++)()
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.