File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -17,29 +17,25 @@ const inputs = {
17
17
} ;
18
18
19
19
function getParams ( str ) {
20
- const out = [ ] ;
21
- for ( const key of str . split ( '&' ) ) {
22
- out . push ( key , '' ) ;
23
- }
24
- return out ;
20
+ return str . split ( '&' ) ;
25
21
}
26
22
27
23
const bench = common . createBenchmark ( main , {
28
24
type : Object . keys ( inputs ) ,
29
- n : [ 1e6 ] ,
30
- } , {
31
- flags : [ '--expose-internals' ] ,
25
+ n : [ 2e6 ] ,
32
26
} ) ;
33
27
34
28
function main ( { type, n } ) {
35
- const searchParams = require ( 'internal/url' ) . searchParamsSymbol ;
36
29
const input = inputs [ type ] ;
37
30
const params = new URLSearchParams ( ) ;
38
31
const array = getParams ( input ) ;
39
32
33
+ for ( let i = 0 ; i < array . length ; i ++ ) {
34
+ params . append ( array [ i ] , '' ) ;
35
+ }
36
+
40
37
bench . start ( ) ;
41
38
for ( let i = 0 ; i < n ; i ++ ) {
42
- params [ searchParams ] = array . slice ( ) ;
43
39
params . sort ( ) ;
44
40
}
45
41
bench . end ( n ) ;
You can’t perform that action at this time.
0 commit comments