File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const common = require ( '../common.js' ) ;
3
+
4
+ const inputs = {
5
+ valid : 'adsfadsfadsf' ,
6
+ validsurr : '\uda23\ude23\uda1f\udfaa\ud800\udfff\uda23\ude23\uda1f\udfaa' +
7
+ '\ud800\udfff' ,
8
+ someinvalid : 'asasfdfasd\uda23' ,
9
+ allinvalid : '\udc45\uda23 \udf00\udc00 \udfaa\uda12 \udc00\udfaa' ,
10
+ nonstring : { toString ( ) { return 'asdf' ; } }
11
+ } ;
12
+ const bench = common . createBenchmark ( main , {
13
+ input : Object . keys ( inputs ) ,
14
+ n : [ 5e7 ]
15
+ } , {
16
+ flags : [ '--expose-internals' ]
17
+ } ) ;
18
+
19
+ function main ( conf ) {
20
+ const { toUSVString } = require ( 'internal/url' ) ;
21
+ const str = inputs [ conf . input ] ;
22
+ const n = conf . n | 0 ;
23
+
24
+ bench . start ( ) ;
25
+ for ( var i = 0 ; i < n ; i ++ )
26
+ toUSVString ( str ) ;
27
+ bench . end ( n ) ;
28
+ }
You can’t perform that action at this time.
0 commit comments