-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
45 lines (42 loc) · 1.73 KB
/
test.html
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
45
<script src="benchmark.js"></script>
<script src="filter2.js"></script>
<script src="filter3.js"></script>
<script type="text/javascript">
var testCase = [{
msg1: {from: 'jack@example.com', to: 'jill@example.org'},
msg2: {from: 'noreply@spam.com', to: 'jill@example.org'},
msg3: {from: 'boss@work.com', to: 'jack@example.com'},
msg4: {from: 'jack@example.com', to: 'jill@example.org'},
msg5: {from: 'noreply@spam.com', to: 'jill@example.org'},
msg6: {from: 'boss@work.com', to: 'jack@example.com'},
msg7: {from: 'jack@example.com', to: 'jill@example.org'},
msg8: {from: 'noreply@spam.com', to: 'jfg@fdsfsd.org'},
msg9: {from: 'boss@work.com', to: 'jack@example.com'},
msg10: {from: 'jack@example.com', to: 'jill@dddd.org'},
msg11: {from: 'noreply@spam.com', to: 'ddsa@ggfgdf.org'},
msg12: {from: 'boss@work.com', to: 'jack@example.com'}
}, [
{from: '*@work.com', action: 'tag work'},
{from: '*@spam.com', action: 'tag spam'},
{from: 'jack@example.com', to: 'jill@example.org', action: 'folder jack'},
{to: 'jill@example.org', action: 'forward to jill@elsewhere.com'}
]]
var suite = new Benchmark.Suite;
// add tests
suite
.add('Filter3', function() {
filter3.apply(this, testCase);
})
.add('Filter2', function() {
filter2.apply(this, testCase);
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').pluck('name'));
})
// run async
.run({ 'async': true });
</script>