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
This test compares the impact of event bubbling in an angular application and compares it against a "flat" event bus provided by $rootScope.$emit.
The good thing is there should barely cases where you actually need $broadcast. Learn how to avoid it here:
http://stackoverflow.com/a/19498009/288703
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.3/angular.min.js"></script>
<script>
angular
.module("testApp",[])
.controller("testController",function($rootScope, $scope) {
}) .controller("testControllertwo",function($rootScope, $scope) {
});
</script>
<div ng-app="testApp">
<div ng-controller="testController">
</div>
<div ng-controller="testControllertwo">
</div>
</div>
Ready to run.
Test | Ops/sec | |
---|---|---|
$broadcast |
| ready |
$emit |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.