File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
33const common = require ( '../common.js' ) ;
4- // TODO: benchmark has access to internal modules?
5- const _checkInvalidHeaderChar = require ( '_http_common' ) . _checkInvalidHeaderChar ;
64
75const groupedInputs = {
86 // Representative set of inputs from an AcmeAir benchmark run:
@@ -52,9 +50,13 @@ const inputs = [
5250const bench = common . createBenchmark ( main , {
5351 input : inputs . concat ( Object . keys ( groupedInputs ) ) ,
5452 n : [ 1e6 ] ,
53+ } , {
54+ flags : [ '--expose-internals' , '--no-warnings' ] ,
5555} ) ;
5656
5757function main ( { n, input } ) {
58+ const checkInvalidHeaderChar = require ( 'internal/http/common' ) . _checkInvalidHeaderChar ;
59+
5860 let inputs = [ input ] ;
5961 if ( Object . hasOwn ( groupedInputs , input ) ) {
6062 inputs = groupedInputs [ input ] ;
@@ -63,7 +65,7 @@ function main({ n, input }) {
6365 const len = inputs . length ;
6466 bench . start ( ) ;
6567 for ( let i = 0 ; i < n ; i ++ ) {
66- _checkInvalidHeaderChar ( inputs [ i % len ] ) ;
68+ checkInvalidHeaderChar ( inputs [ i % len ] ) ;
6769 }
6870 bench . end ( n ) ;
6971}
Original file line number Diff line number Diff line change 11'use strict' ;
22
33const common = require ( '../common.js' ) ;
4- // TODO: benchmark has access to internal modules?
5- const _checkIsHttpToken = require ( '_http_common' ) . _checkIsHttpToken ;
64
75const bench = common . createBenchmark ( main , {
86 key : [
@@ -39,12 +37,16 @@ const bench = common.createBenchmark(main, {
3937 'alternate-protocol:' , // slow bailout
4038 ] ,
4139 n : [ 1e6 ] ,
40+ } , {
41+ flags : [ '--expose-internals' , '--no-warnings' ] ,
4242} ) ;
4343
4444function main ( { n, key } ) {
45+ const checkIsHttpToken = require ( 'internal/http/common' ) . _checkIsHttpToken ;
46+
4547 bench . start ( ) ;
4648 for ( let i = 0 ; i < n ; i ++ ) {
47- _checkIsHttpToken ( key ) ;
49+ checkIsHttpToken ( key ) ;
4850 }
4951 bench . end ( n ) ;
5052}
You can’t perform that action at this time.
0 commit comments