We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 36aeae8 commit b7fc957Copy full SHA for b7fc957
benchmark/url/url.js
@@ -0,0 +1,26 @@
1
+var common = require('../common.js');
2
+var url = require('url');
3
+
4
+var bench = common.createBenchmark(main, {
5
+ type: 'one two three four five'.split(' '),
6
+ n: [25e4]
7
+});
8
9
+function main(conf) {
10
+ var type = conf.type;
11
+ var n = conf.n | 0;
12
13
+ var inputs = {
14
+ one: 'http://nodejs.org/docs/latest/api/url.html#url_url_format_urlobj',
15
+ two: 'http://blog.nodejs.org/',
16
+ three: 'https://encrypted.google.com/search?q=url&q=site:npmjs.org&hl=en',
17
+ four: 'javascript:alert("node is awesome");',
18
+ five: 'some.ran/dom/url.thing?oh=yes#whoo',
19
+ };
20
+ var input = inputs[type] || '';
21
22
+ bench.start();
23
+ for (var i = 0; i < n; i += 1)
24
+ url.parse(input);
25
+ bench.end(n);
26
+}
0 commit comments