PubSubSubcribe
JavaScript performance comparison
Info
Comparing the subscribe speeds of mroderick/PubSubJs, ifandelse/PostalJs, and uxder/radiojs
Preparation code
<script src="https://raw.github.com/uxder/Radio/master/radio.js">
</script>
<script src="https://raw.github.com/mroderick/PubSubJS/master/src/pubsub.js">
</script>
<script src="https://raw.github.com/postaljs/postal.js/master/example/standard/js/underscore.js">
</script>
<script src="https://raw.github.com/postaljs/postal.js/master/example/standard/js/postal.js">
</script>
<script type="text/javascript">
var mroderick = PubSub;
var uxder = radio;
var ifandelse = postal.channel("channel");
var sub1;
var sub2;
var sub3;
</script>
<script>
Benchmark.prototype.teardown = function() {
if (sub1) {
// Unsubscribe pubsubjs subscription
mroderick.unsubscribe(sub1);
}
if (sub2) {
// unsubscribe postal subscription
sub2.unsubscribe();
}
if (sub3) {
// Unsubscribe radio subscription
uxder("topic").unsubscribe(sub3);
}
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
mroderick pubsub |
|
pending… |
ifandelse postaljs |
|
pending… |
uxder Radio |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Lucas Martin
- Revision 2: published by Lucas Martin
- Revision 3: published by Lucas Martin
- Revision 4: published
0 comments