-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #47179 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Debadree Chatterjee <[email protected]>
- Loading branch information
Showing
7 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
const common = require('../common.js'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
type: Object.keys(common.urls), | ||
n: [25e6], | ||
}); | ||
|
||
function main({ type, n }) { | ||
bench.start(); | ||
for (let i = 0; i < n; i += 1) | ||
URL.canParse(common.urls[type]); | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// This intentionally does not use resources/urltestdata.json to preserve resources. | ||
[ | ||
{ | ||
"url": undefined, | ||
"base": undefined, | ||
"expected": false | ||
}, | ||
{ | ||
"url": "a:b", | ||
"base": undefined, | ||
"expected": true | ||
}, | ||
{ | ||
"url": undefined, | ||
"base": "a:b", | ||
"expected": false | ||
}, | ||
{ | ||
"url": "a:/b", | ||
"base": undefined, | ||
"expected": true | ||
}, | ||
{ | ||
"url": undefined, | ||
"base": "a:/b", | ||
"expected": true | ||
}, | ||
{ | ||
"url": "https://test:test", | ||
"base": undefined, | ||
"expected": false | ||
}, | ||
{ | ||
"url": "a", | ||
"base": "https://b/", | ||
"expected": true | ||
} | ||
].forEach(({ url, base, expected }) => { | ||
test(() => { | ||
assert_equals(URL.canParse(url, base), expected); | ||
}, `URL.canParse(${url}, ${base})`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters