| OLD | NEW |
| 1 // This file must be loaded *after* all the benchmark script files | 1 // This file must be loaded *after* all the benchmark script files |
| 2 | 2 |
| 3 // Instead of V8-style registration of the benchmarks in their own files, | 3 // Instead of V8-style registration of the benchmarks in their own files, |
| 4 // do it here all together, to make changing parameters easier. | 4 // do it here all together, to make changing parameters easier. |
| 5 // Code implementing the benchmark framework goes in base.js, stuff | 5 // Code implementing the benchmark framework goes in base.js, stuff |
| 6 // specific to the benchmarks (e.g. parameters or normalization) goes here. | 6 // specific to the benchmarks (e.g. parameters or normalization) goes here. |
| 7 | 7 |
| 8 var normalization_constants = Object(); | 8 var normalization_constants = Object(); |
| 9 normalization_constants["Richards"] = 35302; |
| 10 normalization_constants["DeltaBlue"] = 66118; |
| 9 normalization_constants["Fannkuchredux"] = 64052288; | 11 normalization_constants["Fannkuchredux"] = 64052288; |
| 10 normalization_constants["Nbody"] = 73000000; | 12 normalization_constants["Nbody"] = 73000000; |
| 11 normalization_constants["Spectralnorm"] = 150020779; | 13 normalization_constants["Spectralnorm"] = 150020779; |
| 12 normalization_constants["Fasta"] = 51667385; | 14 normalization_constants["Fasta"] = 51667385; |
| 13 normalization_constants["Revcomp"] = 23542857; | 15 normalization_constants["Revcomp"] = 23542857; |
| 14 normalization_constants["Binarytrees"] = 383306452; | 16 normalization_constants["Binarytrees"] = 383306452; |
| 15 normalization_constants["Knucleotide"] = 433893130; | 17 normalization_constants["Knucleotide"] = 433893130; |
| 16 normalization_constants["Pidigits"] = 406976744; | 18 normalization_constants["Pidigits"] = 406976744; |
| 17 | 19 |
| 18 | 20 |
| 19 function SetupBenchmark(name, entrypoint, param) { | 21 function SetupBenchmark(name, entrypoint, param) { |
| 20 var benchmark = new BenchmarkSuite(name, normalization_constants[name], [ | 22 var benchmark = new BenchmarkSuite(name, normalization_constants[name], [ |
| 21 new Benchmark(name, function () { entrypoint(param) } ) | 23 new Benchmark(name, function () { entrypoint(param) } ) |
| 22 ]); | 24 ]); |
| 23 } | 25 } |
| 24 | 26 |
| 25 function ClearBenchmarks() { | 27 function ClearBenchmarks() { |
| 26 BenchmarkSuite.suites = []; | 28 BenchmarkSuite.suites = []; |
| 27 } | 29 } |
| 28 | 30 |
| 29 function SetRunModel(model) { | 31 function SetRunModel(model) { |
| 30 BenchmarkSuite.run_model = model; | 32 BenchmarkSuite.run_model = model; |
| 31 } | 33 } |
| 32 | 34 |
| 33 function SetupSmallBenchmarks() { | 35 function SetupSmallBenchmarks() { |
| 36 SetupBenchmark("Richards", RichardsBenchmark, 10000); |
| 37 SetupBenchmark("DeltaBlue", DeltaBlueBenchmark, 100); |
| 34 SetupBenchmark("Fannkuchredux", FannkuchBenchmark, 10); | 38 SetupBenchmark("Fannkuchredux", FannkuchBenchmark, 10); |
| 35 SetupBenchmark("Nbody", NbodyBenchmark, 1000000); | 39 SetupBenchmark("Nbody", NbodyBenchmark, 1000000); |
| 36 SetupBenchmark("Spectralnorm", SpectralnormBenchmark, 350); | 40 SetupBenchmark("Spectralnorm", SpectralnormBenchmark, 350); |
| 37 SetupBenchmark("Fasta", FastaBenchmark, 10000); | 41 SetupBenchmark("Fasta", FastaBenchmark, 10000); |
| 38 SetupBenchmark("Revcomp", RevcompBenchmark, 0); | 42 SetupBenchmark("Revcomp", RevcompBenchmark, 0); |
| 39 SetupBenchmark("Binarytrees", BinarytreesBenchmark, 15); | 43 SetupBenchmark("Binarytrees", BinarytreesBenchmark, 15); |
| 40 SetupBenchmark("Knucleotide", KnucleotideBenchmark, 0); | 44 SetupBenchmark("Knucleotide", KnucleotideBenchmark, 0); |
| 41 SetupBenchmark("Pidigits", PidigitsBenchmark, 1000); | 45 SetupBenchmark("Pidigits", PidigitsBenchmark, 1000); |
| 42 benchmarks = BenchmarkSuite.CountBenchmarks(); | 46 benchmarks = BenchmarkSuite.CountBenchmarks(); |
| 43 SetRunModel("repeated"); | 47 SetRunModel("repeated"); |
| 44 } | 48 } |
| 45 | 49 |
| 46 function SetupLargeBenchmarks() { | 50 function SetupLargeBenchmarks() { |
| 51 SetupBenchmark("Richards", RichardsBenchmark, 1000000); |
| 52 SetupBenchmark("DeltaBlue", DeltaBlueBenchmark, 10000); |
| 47 SetupBenchmark("Fannkuchredux", FannkuchBenchmark, 11); | 53 SetupBenchmark("Fannkuchredux", FannkuchBenchmark, 11); |
| 48 SetupBenchmark("Nbody", NbodyBenchmark, 10000000); | 54 SetupBenchmark("Nbody", NbodyBenchmark, 10000000); |
| 49 SetupBenchmark("Spectralnorm", SpectralnormBenchmark, 5500); | 55 SetupBenchmark("Spectralnorm", SpectralnormBenchmark, 5500); |
| 50 SetupBenchmark("Fasta", FastaBenchmark, 3000000); | 56 SetupBenchmark("Fasta", FastaBenchmark, 3000000); |
| 51 SetupBenchmark("Revcomp", RevcompBenchmark, 0); | 57 SetupBenchmark("Revcomp", RevcompBenchmark, 0); |
| 52 SetupBenchmark("Binarytrees", BinarytreesBenchmark, 18); | 58 SetupBenchmark("Binarytrees", BinarytreesBenchmark, 18); |
| 53 SetupBenchmark("Knucleotide", KnucleotideBenchmark, 0); | 59 SetupBenchmark("Knucleotide", KnucleotideBenchmark, 0); |
| 54 SetupBenchmark("Pidigits", PidigitsBenchmark, 5000); | 60 SetupBenchmark("Pidigits", PidigitsBenchmark, 5000); |
| 55 benchmarks = BenchmarkSuite.CountBenchmarks(); | 61 benchmarks = BenchmarkSuite.CountBenchmarks(); |
| 56 SetRunModel("once"); | 62 SetRunModel("once"); |
| 57 } | 63 } |
| OLD | NEW |