diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /netwerk/test/mochitests/test_url_perf.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/mochitests/test_url_perf.html')
-rw-r--r-- | netwerk/test/mochitests/test_url_perf.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/netwerk/test/mochitests/test_url_perf.html b/netwerk/test/mochitests/test_url_perf.html new file mode 100644 index 0000000000..c403398f06 --- /dev/null +++ b/netwerk/test/mochitests/test_url_perf.html @@ -0,0 +1,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> |