postmessage vs messagechannel

Benchmark created on


Setup

window.addEventListener('message', (event) => {});
const channel = new MessageChannel();
channel.port2.onmessage = (event) => {} 

Test runner

Ready to run.

Testing in
TestOps/sec
postMessage
window.postMessage({})
ready
MessageChannel
channel.port1.postMessage({})
ready

Revisions

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