-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
124 lines (95 loc) · 3.77 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!-- Provide a title. This will be shown on the generated chart -->
<title>Quran Synonyms Test Suite</title>
<script src="lib/angular/angular.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="controllers/controllers.js"></script>
<script src="js/mapper.js"></script>
<script src="js/filters.js"></script>
<script src="js/directives.js"></script>
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/underscore-min.js"></script>
<script src="js/yepnope.1.5.4-min.js"></script>
<script type="text/javascript" src="test/JSLitmus.js"></script>
<script type="text/javascript">
JSLitmus.test("mapRootToTopics('bwA')", function() {return mapRootToTopics('bwA'); });
JSLitmus.test("mapTopicToRoots('A1')", function() {return mapTopicToRoots('A1'); });
JSLitmus.test("mapVerseToRoots(262)", function() {return mapVerseToRoots(262); });
JSLitmus.test("mapRootToVerses('rHm');", function() {return mapRootToVerses('rHm'); });
return;
// The empty form of a non-looping test. This should result in "Infinity"
// operations per second, or very close to it.
JSLitmus.test('empty test (non-looping)', function() {});
// The empty form of a looping test. This should also result in "Infinity"
// operations per second, or very close to it.
JSLitmus.test('empty test', function(count) {
while (count--);
});
// Test how much overhead there is in invoking a function
var emptyFunction = function() {};
JSLitmus.test('function overhead (non-looping)', function() {
emptyFunction();
});
// Test function invocation using a looping test. This will be a bit faster
// both becasue it's a looping function, and because 'f' is local to the test
// function.
JSLitmus.test('function overhead', function(count) {
var f = emptyFunction;
while (count--) f();
});
// Test Array.join() method so we can see how it compares to the "+"
// operator
JSLitmus.test('"hello" + "world" (non-looping)', function() {
var a = "hello", b = "world", x;
x = a+b;
});
// Test Array.join() method so we can see how it compares to the "+"
// operator
JSLitmus.test('"hello" + "world"', function(count) {
var a = "hello", b = "world", x;
while(count--) x = a+b;
});
// Test Array.join() method so we can see how it compares to the "+"
// operator
JSLitmus.test('string join()', function(count) {
var a = ['hello', 'world'];
while (count--) a.join();
});
// Is Math.random() fast or slow?
JSLitmus.test('Math.random()', function(count) {
while (count--) Math.random();
});
// How fast is a simple regex test()? Let's find out...
JSLitmus.test('RegExp.test()', function(count) {
while (count--) /rl/.test('hello world');
});
// Hmm... does caching the regex out side of the iteration help?
JSLitmus.test('cached RegExp.test()', function(count) {
var re = /rl/;
while (count--) re.test('hello world');
});
// What about Date creation? Is that fast or slow?
JSLitmus.test('new Date()', function(count) {
while (count--) new Date();
});
// What if we set innerHTML to a Date? Since this operation is pretty slow
// there's no need to implement this as a looping test.
JSLitmus.test('set Element.innerHTML', function() {
document.getElementById('test_element').innerHTML = new Date();
});
// Test Array creation, so we can compare to other operations
JSLitmus.test('new Array()', function(count) {
while (count--) {var a = [];}
});
</script>
</head>
<body>
<p>Quran Synonyms Test Suite</p>
<div id="test_element" style="overflow:hidden; width: 1px; height:1px;"></div>
</body>
</html>