blob: 72c87d3ea424f2e175e63aacde137602b9bf13ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<!DOCTYPE html>
<meta charset='utf-8' />
<title>Benchmarks</title>
<script src='runner.js'></script>
<script>
suite("String matching", function() {
bench("String#match", function() {
!! "Hello world".match(/o/);
});
bench("String#indexOf", function() {
"Hello world".indexOf('o') > -1;
});
bench("RegExp#test", function() {
!! /o/.test("Hello world");
});
before(function() {
// Things to execute before all benchmarks in the suite.
// Does not count into a benchmark's elapsed time.
});
afterEach(function() {
// Things to execute after each benchmark cycle.
// Does not count into a benchmark's elapsed time.
});
});
/*
// Advanced examples
// ----------------------------------------------------------------------------
// You can specify Benchmark.js options in suite() and bench().
suite("My suite", { maxTime: 10 }, function() {
bench("My benchmark", function() {
}, {
onCycle: ...
});
});
*/
</script>
|