Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0
Firefox 77
Mac OS X 10.15
Desktop
4 years ago
Test name Executions per second
instance method 96347256.0 Ops/sec
callback 111812848.0 Ops/sec
Script Preparation code:
x
 
const _onSuccess = () => {
    return {
        a: "something",
        b: "something else"
    }
}
const upload = (successCb) => {
    return successCb()
}
const onClick = () => {
    return upload(_onSuccess)
}
const onClickCb = () => {
    const onSuccess = () => {
        return {
            a: "something",
            b: "something else"
        }
    }
    return upload(onSuccess)
}
window.onClick = onClick
window.onClickCb = onClickCb
Tests:
  • instance method

     
    onClick()
  • callback

     
    onClickCb()