File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
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 six' . 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
+ six :
'https://user:[email protected] /' ,
20
+ } ;
21
+ var input = inputs [ type ] || '' ;
22
+
23
+ bench . start ( ) ;
24
+ for ( var i = 0 ; i < n ; i += 1 )
25
+ url . parse ( input ) ;
26
+ bench . end ( n ) ;
27
+ }
You can’t perform that action at this time.
0 commit comments