Script Preparation code:
x
 
var audio = document.createElement("audio");
function andAOne(e){ 
  e.count = (e.count|| 0) +1; 
  e.count === 501 && e.preventDefault();
}
function andAOneAndAStop(e){ 
  e.count = (e.count|| 0) +1; 
  e.count === 501 && e.stopPropagationImmediately();
}
function andAOneAndANeverStop(e){ 
  e.count = (e.count|| 0) +1; 
  e.count === 5001 && e.stopPropagationImmediately();
}
Tests:
  • async 1000

     
    for (var i = 0; i <100; i++)
      audio.addEventListener("ratechange",andAOne.bind({}));
    audio.playbackRate = 2;
  • async 501

     
    for (var i = 0; i <100; i++)
      audio.addEventListener("ratechange",andAOneAndAStop.bind({}));
    audio.playbackRate = 2;
  • sync 1000

     
    for (var i = 0; i <100; i++)
      audio.addEventListener("click",andAOne.bind({}));
    audio.click();
  • sync 501

     
    for (var i = 0; i <100; i++)
      audio.addEventListener("click",andAOneAndAStop.bind({}));
    audio.click();
  • sync 1000 with a fake stopImmediatePropagation()

     
    for (var i = 0; i <100; i++)
      audio.addEventListener("click",andAOneAndANeverStop.bind({}));
    audio.click();
  • async 1000 with a fake stopImmediatePropagation()

     
    for (var i = 0; i <100; i++)
      audio.addEventListener("ratechange",andAOneAndANeverStop.bind({}));
    audio.playbackRate = 2;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    async 1000
    async 501
    sync 1000
    sync 501
    sync 1000 with a fake stopImmediatePropagation()
    async 1000 with a fake stopImmediatePropagation()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (X11; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0
Firefox 79 on Linux
View result in a separate tab
Test name Executions per second
async 1000 10.3 Ops/sec
async 501 4.0 Ops/sec
sync 1000 24.7 Ops/sec
sync 501 8.4 Ops/sec
sync 1000 with a fake stopImmediatePropagation() 6.3 Ops/sec
async 1000 with a fake stopImmediatePropagation() 3.7 Ops/sec