jquery trigger vs pub/sub (v4)

Revision 4 of this benchmark created by Dmitry 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/src/pubsub.js"></script>
<script>
  $(document).bind('my-event', $.noop);
var obj = $({});
obj.bind('my-event', $.noop);
  $.subscribe('my-event', $.noop);
  PubSub.subscribe('my-event', $.noop);
var $doc = $(document);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
trigger
$doc.trigger('my-event', true);
ready
pub/sub
$.publish('my-event', true);
ready
PubSub
PubSub.publish('my-event', true);
ready
Object jQuery trigger
obj.trigger('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