jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
pubsub.js tend to be the richest in functionality publish/subscribe JavaScript library.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://ryejs.com/dist/rye-0.1.0.min.js"></script>
<script src="https://rawgit.com/Sahadar/pubsub.js/sahadar/extended_subscription/pubsub.js"></script>
<script>
var callback1 = function(event) {
return false;
};
var callback2 = function() {};
var payload = {
somekey: 'some value'
};
var body;
var someJqueryObject = $({});
// let's use jQuery.ready to make sure that the DOM is ready,
// before trying to work with it
jQuery(function() {
// we'll use the body element to exchange messages for jQuery
// if using deeper nested elements, jQuery will be slower, as custom events bubble
body = $('body');
// subscribe our callback1 function to the custom event for jQuery, only once
body.bind('my-event', callback1);
// subscribe our callback1 function to the custom event for the plain jQuery object (non-DOM)
someJqueryObject.bind('my-event', callback1);
// subscribe our callback2 function to the message for PubSub
pubsub.subscribe('my-event', callback2)
// subscribe the callback2 function to the message for Rye
Rye.subscribe('my-event', callback2)
// Use document instead of 'body' as the anchor for custom events
doc = $(document)
});
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery DOM - trigger |
| ready |
jQuery Object - trigger |
| ready |
pubsub.js - publish |
| ready |
jQuery document - trigger |
| ready |
Rye - publish |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.