blob: c403398f067ed51b22e9cda26993b87c4aba1afe (
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
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
|
<!DOCTYPE HTML>
<html>
<head>
<title>Networking performance test: url parsing</title>
</head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script>
// this test is just used locally to get an idea of how long url parsing takes
"use strict";
let runs = 20000;
let timeToCreateDataUrl = 0;
let timeToCreateDataSlashUrl = 0;
let timeToCreateJsUrl = 0;
let timeToCreateJsSlashUrl = 0;
// data scheme
add_task(async () => {
let before = new Date().getTime();
for (let i = 0; i < runs; i++) {
new URL("data:,test" + i);
}
let after = new Date().getTime();
timeToCreateDataUrl = after - before;
dump(
"Time to create data url (milliseconds): " + timeToCreateDataUrl + "\n"
);
});
// data://
add_task(async () => {
let before = new Date().getTime();
for (let i = 0; i < runs; i++) {
new URL("data://,test" + i);
}
let after = new Date().getTime();
timeToCreateDataSlashUrl = after - before;
dump(
"Time to create data // url (milliseconds): " + timeToCreateDataSlashUrl + "\n"
);
});
// javascript scheme
add_task(async () => {
let beforeJs = new Date().getTime();
for (let i = 0; i < runs; i++) {
new URL("javascript:,test" + i);
}
let afterJs = new Date().getTime();
timeToCreateJsUrl = afterJs - beforeJs;
dump(
"Time to create JS url (milliseconds): " + timeToCreateJsUrl + "\n"
);
});
// javascript://
add_task(async () => {
let beforeJs = new Date().getTime();
for (let i = 0; i < runs; i++) {
new URL("javascript://,test" + i);
}
let afterJs = new Date().getTime();
timeToCreateJsSlashUrl = afterJs - beforeJs;
dump(
"Time to create JS // url (milliseconds): " + timeToCreateJsSlashUrl + "\n"
);
});
ok("finished");
</script>
<body>
</body>
</html>
|