jquery trigger vs pub/sub

Benchmark created by Cary Landholt on


Preparation HTML

<script src="http://code.jquery.com/jquery-git.js">
</script>
<script src="https://raw.github.com/gist/661855/928bb70ccabd18fe0089d50ea5dba101c0ebe1ef/jquery.ba-tinypubsub.js">
</script>
<script src="https://raw.github.com/mroderick/PubSubJS/master/pubsub.js"></script>
<script>
  $(document).bind('my-event', $.noop);
  $.subscribe('my-event', $.noop);
  PubSub.subscribe('my-event', $.noop);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
trigger
$(document).trigger('my-event', true);
ready
pub/sub
$.publish('my-event', true);
ready
PubSub
PubSub.publish('my-event', true);
ready

Revisions

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

  • Revision 1: published by Cary Landholt on
  • Revision 3: published by Jakeb on
  • Revision 4: published by Dmitry on