-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
46 lines (39 loc) · 1.13 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
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://underscorejs.org/underscore.js"></script>
<script src="underscore-join.js"></script>
<script>
var uniqueIdsPerList = 1000;
var objectsPerList = 10000;
var lists = [
[],
[],
[]
];
var startTime = +new Date();
_.each(lists, function (list, index) {
for (var i = 0; i < objectsPerList; i++) {
var tempObj = {};
var propName = "list" + index + "prop" + i;
tempObj["id"] = index + i % uniqueIdsPerList;
tempObj[propName] = propName;
list.push(tempObj);
}
});
var endTime = +new Date();
console.log(endTime - startTime);
joinArguments = lists.concat(function (l1, l2) {
return l1.id === l2.id;
});
startTime = +new Date();
var join = _.join.apply(_.join, joinArguments);
endTime = +new Date();
console.log(endTime - startTime);
console.log(join);
</script>
</head>
<body>
</body>
</html>