|
1 | 1 | var Benchmark = require("benchmark"); |
2 | 2 | var once = new Benchmark.Suite(); |
| 3 | +var eightTimesTheSame = new Benchmark.Suite(); |
| 4 | +var eightTimesTheSameRequire = new Benchmark.Suite(); |
3 | 5 | var fourTimes = new Benchmark.Suite(); |
4 | 6 | var eightTimes = new Benchmark.Suite(); |
5 | 7 | var onceRequire = new Benchmark.Suite(); |
@@ -715,6 +717,98 @@ fourTimesRequire |
715 | 717 | }) |
716 | 718 | .run({ async: false }); |
717 | 719 |
|
| 720 | +eightTimesTheSame |
| 721 | + .add("8 calls (the same parameters)", function() { |
| 722 | + process(styles, portrait, Platform); |
| 723 | + process(styles, portrait, Platform); |
| 724 | + process(styles, portrait, Platform); |
| 725 | + process(styles, portrait, Platform); |
| 726 | + process(styles, portrait, Platform); |
| 727 | + process(styles, portrait, Platform); |
| 728 | + process(styles, portrait, Platform); |
| 729 | + process(styles, portrait, Platform); |
| 730 | + }) |
| 731 | + .add("8 calls (the same parameters, return early)", function() { |
| 732 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 733 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 734 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 735 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 736 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 737 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 738 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 739 | + process(stylesWithoutMediaQueries, portrait, Platform); |
| 740 | + }) |
| 741 | + .on("cycle", function(event) { |
| 742 | + console.log(String(event.target)); |
| 743 | + }) |
| 744 | + .on("complete", function() { |
| 745 | + console.log("Fastest is " + this.filter("fastest").map("name")); |
| 746 | + console.log("-----------------------------------------"); |
| 747 | + }) |
| 748 | + .run({ async: false }); |
| 749 | + |
| 750 | +eightTimesTheSameRequire |
| 751 | + .add("8 calls (the same parameters, require)", function() { |
| 752 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 753 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 754 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 755 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 756 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 757 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 758 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 759 | + require("./dist/perf-tests/current").process(styles, portrait, Platform); |
| 760 | + }) |
| 761 | + .add("8 calls (the same parameters, require, return early)", function() { |
| 762 | + require("./dist/perf-tests/current").process( |
| 763 | + stylesWithoutMediaQueries, |
| 764 | + portrait, |
| 765 | + Platform |
| 766 | + ); |
| 767 | + require("./dist/perf-tests/current").process( |
| 768 | + stylesWithoutMediaQueries, |
| 769 | + portrait, |
| 770 | + Platform |
| 771 | + ); |
| 772 | + require("./dist/perf-tests/current").process( |
| 773 | + stylesWithoutMediaQueries, |
| 774 | + portrait, |
| 775 | + Platform |
| 776 | + ); |
| 777 | + require("./dist/perf-tests/current").process( |
| 778 | + stylesWithoutMediaQueries, |
| 779 | + portrait, |
| 780 | + Platform |
| 781 | + ); |
| 782 | + require("./dist/perf-tests/current").process( |
| 783 | + stylesWithoutMediaQueries, |
| 784 | + portrait, |
| 785 | + Platform |
| 786 | + ); |
| 787 | + require("./dist/perf-tests/current").process( |
| 788 | + stylesWithoutMediaQueries, |
| 789 | + portrait, |
| 790 | + Platform |
| 791 | + ); |
| 792 | + require("./dist/perf-tests/current").process( |
| 793 | + stylesWithoutMediaQueries, |
| 794 | + portrait, |
| 795 | + Platform |
| 796 | + ); |
| 797 | + require("./dist/perf-tests/current").process( |
| 798 | + stylesWithoutMediaQueries, |
| 799 | + portrait, |
| 800 | + Platform |
| 801 | + ); |
| 802 | + }) |
| 803 | + .on("cycle", function(event) { |
| 804 | + console.log(String(event.target)); |
| 805 | + }) |
| 806 | + .on("complete", function() { |
| 807 | + console.log("Fastest is " + this.filter("fastest").map("name")); |
| 808 | + console.log("-----------------------------------------"); |
| 809 | + }) |
| 810 | + .run({ async: false }); |
| 811 | + |
718 | 812 | eightTimes |
719 | 813 | .add("8 calls (orientation change)", function() { |
720 | 814 | process(styles, portrait, Platform); |
|
0 commit comments