@@ -1604,12 +1604,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
16041604 this . setOptionValueWithSource ( name , val , valueSource ) ;
16051605 } ;
16061606 this . on ( "option:" + oname , ( val ) => {
1607- const invalidValueMessage = `error: option '${ option . flags } ' argument '${ val } ' is invalid.` ;
1608- handleOptionValue ( val , invalidValueMessage , "cli" ) ;
1607+ handleOptionValue ( val , `error: option '${ option . flags } ' argument '${ val } ' is invalid.` , "cli" ) ;
16091608 } ) ;
16101609 if ( option . envVar ) this . on ( "optionEnv:" + oname , ( val ) => {
1611- const invalidValueMessage = `error: option '${ option . flags } ' value '${ val } ' from env '${ option . envVar } ' is invalid.` ;
1612- handleOptionValue ( val , invalidValueMessage , "env" ) ;
1610+ handleOptionValue ( val , `error: option '${ option . flags } ' value '${ val } ' from env '${ option . envVar } ' is invalid.` , "env" ) ;
16131611 } ) ;
16141612 return this ;
16151613 }
@@ -1949,11 +1947,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
19491947 */
19501948 _checkForMissingExecutable ( executableFile , executableDir , subcommandName ) {
19511949 if ( fs . existsSync ( executableFile ) ) return ;
1952- const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${ executableDir } '` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory" ;
19531950 const executableMissing = `'${ executableFile } ' does not exist
19541951 - if '${ subcommandName } ' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
19551952 - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
1956- - ${ executableDirMessage } ` ;
1953+ - ${ executableDir ? `searched for local subcommand relative to directory ' ${ executableDir } '` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory" } ` ;
19571954 throw new Error ( executableMissing ) ;
19581955 }
19591956 /**
@@ -3461,9 +3458,7 @@ const transform = function(original_options = {}) {
34613458 if ( end ) return false ;
34623459 const { encoding, escape, quote } = this . options ;
34633460 const { quoting, needMoreDataSize, recordDelimiterMaxLength } = this . state ;
3464- const numOfCharLeft = bufLen - i - 1 ;
3465- const requiredLength = Math . max ( needMoreDataSize , recordDelimiterMaxLength === 0 ? Buffer . from ( "\r\n" , encoding ) . length : recordDelimiterMaxLength , quoting ? ( escape === null ? 0 : escape . length ) + quote . length : 0 , quoting ? quote . length + recordDelimiterMaxLength : 0 ) ;
3466- return numOfCharLeft < requiredLength ;
3461+ return bufLen - i - 1 < Math . max ( needMoreDataSize , recordDelimiterMaxLength === 0 ? Buffer . from ( "\r\n" , encoding ) . length : recordDelimiterMaxLength , quoting ? ( escape === null ? 0 : escape . length ) + quote . length : 0 , quoting ? quote . length + recordDelimiterMaxLength : 0 ) ;
34673462 } ,
34683463 parse : function ( nextBuf , end , push , close ) {
34693464 const { bom, comment_no_infix, encoding, from_line, ltrim, max_record_size, raw, relax_quotes, rtrim, skip_empty_lines, to, to_line } = this . options ;
@@ -4149,8 +4144,7 @@ function createMdTable(options) {
41494144 const hSep = [ ...headerSep ] ;
41504145 hSep . length = header . length ;
41514146 header . forEach ( ( col , i ) => {
4152- const s$1 = hSep [ i ] || "---" ;
4153- const h = calcColHeaderSep ( s$1 , strWidth ( col ) ) ;
4147+ const h = calcColHeaderSep ( hSep [ i ] || "---" , strWidth ( col ) ) ;
41544148 const jL = h . startsWith ( ":" ) ;
41554149 const jR = h . endsWith ( ":" ) ;
41564150 justifyCols [ i ] = jL ? justifyLeft : jR ? justifyRight : justifyLeft ;
@@ -4207,9 +4201,7 @@ function strWidth(str) {
42074201async function perfReport ( csvFile ) {
42084202 const limit = changeDate ( /* @__PURE__ */ new Date ( ) , - 30 ) . getTime ( ) ;
42094203 console . error ( `Generating performance report from ${ csvFile } since ${ new Date ( limit ) . toISOString ( ) } ` ) ;
4210- const recordsInRange = ( await readCsvData ( csvFile ) ) . filter ( ( r ) => r . platform === "linux" && r . timestamp >= limit ) ;
4211- const runsInRange = groupCsvRecordsByRun ( recordsInRange ) ;
4212- const runs = filterOutIncompleteRuns ( runsInRange ) ;
4204+ const runs = filterOutIncompleteRuns ( groupCsvRecordsByRun ( ( await readCsvData ( csvFile ) ) . filter ( ( r ) => r . platform === "linux" && r . timestamp >= limit ) ) ) ;
42134205 const records = runs . flat ( ) ;
42144206 console . error ( `Runs: ${ runs . length } , Records: ${ records . length } ` ) ;
42154207 reportOnCsvRecords ( records ) ;
@@ -4298,8 +4290,7 @@ function reportOnCsvRecords(records) {
42984290 const runEndTime = Math . max ( ...run . map ( ( r ) => r . timestamp ) ) ;
42994291 const runId = ( i + 1 ) . toFixed ( 0 ) . padStart ( 2 , "0" ) ;
43004292 const runRepoNames = new Set ( run . map ( ( r ) => r . repo ) ) ;
4301- const groupedByRepo = new Map ( repos . map ( ( repo ) => [ repo , 0 ] ) ) ;
4302- const unexpectedResults = [ ...countCsvRecordsByRepo ( run , groupedByRepo ) ] . filter ( ( [ _ , count ] ) => count != 1 ) ;
4293+ const unexpectedResults = [ ...countCsvRecordsByRepo ( run , new Map ( repos . map ( ( repo ) => [ repo , 0 ] ) ) ) ] . filter ( ( [ _ , count ] ) => count != 1 ) ;
43034294 console . error ( `Run ${ runId } ${ new Date ( runStartTime ) . toISOString ( ) } repos: ${ pad ( runRepoNames . size , 2 ) } ${ deltaTimeMsInDHMS ( runEndTime - runStartTime ) } ` ) ;
43044295 for ( const [ repo , count ] of unexpectedResults ) console . error ( ` ${ repo . padEnd ( 20 ) } : ${ count } records` ) ;
43054296 } ) ;
@@ -4324,8 +4315,7 @@ function deltaTimeSInDHMS(deltaSec) {
43244315 return result ;
43254316}
43264317async function readCsvData ( csvFile ) {
4327- const csv = await promises . readFile ( csvFile , "utf8" ) ;
4328- return parse ( csv , {
4318+ return parse ( await promises . readFile ( csvFile , "utf8" ) , {
43294319 columns : true ,
43304320 cast : true
43314321 } ) ;
@@ -4410,29 +4400,27 @@ function createPerfTable1(data) {
44104400 const sp = ( v , pad$1 = 5 , fixed = 1 ) => p ( s ( v , fixed ) , pad$1 ) ;
44114401 const stats = calcAllStats ( data ) ;
44124402 const maxRelSd = Math . max ( ...stats . map ( ( s$1 ) => s$1 . sd * s$1 . sum / s$1 . count ) ) ;
4413- const rows = data . map ( ( [ repo ] , i ) => {
4414- const { point, min, max, sum, count, sd, avg } = stats [ i ] ;
4415- const relSd = sd * sum / count ;
4416- const sdGraph = sd ? plotPointRelativeToStandardDeviation ( point , sd , avg , 21 , Math . max ( 2.5 + Math . log ( maxRelSd / relSd ) / 6 , Math . abs ( point - avg ) / sd ) ) : "" ;
4417- return [
4418- sub ( repo ) ,
4419- s ( point , 2 ) ,
4420- `${ sp ( min ) } / ${ sp ( avg ) } / ${ sp ( max ) } ` ,
4421- sp ( sd , 5 , 2 ) ,
4422- `\`${ sdGraph } \``
4423- ] ;
4424- } ) ;
4425- const table = createMdTable ( {
4403+ return inject `
4404+ ## Time to Process Files
4405+
4406+ ${ createMdTable ( {
44264407 header : `
44274408 | Repository | Elapsed | Min/Avg/Max | SD | SD Graph |
44284409 | ---------- | ------: | :-----------: | --: | -------- |
44294410 ` ,
4430- rows
4431- } ) ;
4432- return inject `
4433- ## Time to Process Files
4434-
4435- ${ table }
4411+ rows : data . map ( ( [ repo ] , i ) => {
4412+ const { point, min, max, sum, count, sd, avg } = stats [ i ] ;
4413+ const relSd = sd * sum / count ;
4414+ const sdGraph = sd ? plotPointRelativeToStandardDeviation ( point , sd , avg , 21 , Math . max ( 2.5 + Math . log ( maxRelSd / relSd ) / 6 , Math . abs ( point - avg ) / sd ) ) : "" ;
4415+ return [
4416+ sub ( repo ) ,
4417+ s ( point , 2 ) ,
4418+ `${ sp ( min ) } / ${ sp ( avg ) } / ${ sp ( max ) } ` ,
4419+ sp ( sd , 5 , 2 ) ,
4420+ `\`${ sdGraph } \``
4421+ ] ;
4422+ } )
4423+ } ) }
44364424
44374425 Note:
44384426 - Elapsed time is in seconds.
@@ -4441,70 +4429,66 @@ function createPerfTable1(data) {
44414429function createFpsPerfTable ( data ) {
44424430 const fn = ( d ) => 1e3 * d . files / d . elapsedMs ;
44434431 const stats = calcAllStats ( data , fn ) ;
4444- const rows = data . map ( ( [ repo , records ] , i ) => {
4445- const { point, count, trend, min, avg } = stats [ i ] ;
4446- const trendGraph = simpleHistogram ( trend , min * .9 ) ;
4447- const relChange = ( 100 * ( point - avg ) / ( avg || 1 ) ) . toFixed ( 2 ) + "%" ;
4448- const lastRecord = records [ records . length - 1 ] ;
4449- const fps = fn ( lastRecord ) ;
4450- const elapsed = lastRecord . elapsedMs ;
4451- const nFiles = lastRecord . files . toFixed ( 0 ) ;
4452- return [
4453- sub ( repo ) ,
4454- nFiles ,
4455- s ( elapsed , 2 ) ,
4456- fps . toFixed ( 2 ) ,
4457- relChange ,
4458- `\`${ trendGraph } \`` ,
4459- count
4460- ] ;
4461- } ) ;
4462- const table = createMdTable ( {
4432+ return inject `
4433+ ## Files per Second over Time
4434+
4435+ ${ createMdTable ( {
44634436 header : `
44644437 | Repository | Files | Sec | Fps | Rel | Trend Fps | N |
44654438 | ---------- | ----: | ---: | ---: | ----: | --------- | ----: |
44664439 ` ,
4467- rows
4468- } ) ;
4469- return inject `
4470- ## Files per Second over Time
4471-
4472- ${ table }
4440+ rows : data . map ( ( [ repo , records ] , i ) => {
4441+ const { point, count, trend, min, avg } = stats [ i ] ;
4442+ const trendGraph = simpleHistogram ( trend , min * .9 ) ;
4443+ const relChange = ( 100 * ( point - avg ) / ( avg || 1 ) ) . toFixed ( 2 ) + "%" ;
4444+ const lastRecord = records [ records . length - 1 ] ;
4445+ const fps = fn ( lastRecord ) ;
4446+ const elapsed = lastRecord . elapsedMs ;
4447+ const nFiles = lastRecord . files . toFixed ( 0 ) ;
4448+ return [
4449+ sub ( repo ) ,
4450+ nFiles ,
4451+ s ( elapsed , 2 ) ,
4452+ fps . toFixed ( 2 ) ,
4453+ relChange ,
4454+ `\`${ trendGraph } \`` ,
4455+ count
4456+ ] ;
4457+ } )
4458+ } ) }
44734459 ` ;
44744460}
44754461function createThroughputPerfTable ( data ) {
44764462 data = data . map ( ( [ repo , records ] ) => [ repo , records . filter ( ( r ) => r . kilobytes ) ] ) ;
44774463 const fn = ( d ) => 1e3 * ( d . kilobytes || 0 ) / d . elapsedMs ;
44784464 const stats = calcAllStats ( data , fn ) ;
4479- const rows = data . map ( ( [ repo , records ] , i ) => {
4480- const { point, count, trend, min, avg } = stats [ i ] ;
4481- const trendGraph = simpleHistogram ( trend , min * .9 ) ;
4482- const relChange = ( 100 * ( point - avg ) / ( avg || 1 ) ) . toFixed ( 2 ) + "%" ;
4483- const lastRecord = records [ records . length - 1 ] ;
4484- const mps = fn ( lastRecord ) ;
4485- const elapsed = lastRecord . elapsedMs ;
4486- const nFiles = lastRecord . files . toFixed ( 0 ) ;
4487- return [
4488- sub ( repo ) ,
4489- nFiles ,
4490- s ( elapsed , 2 ) ,
4491- mps . toFixed ( 2 ) ,
4492- relChange ,
4493- `\`${ trendGraph } \`` ,
4494- count
4495- ] ;
4496- } ) ;
4497- const table = createMdTable ( {
4465+ return inject `
4466+ ## Data Throughput
4467+
4468+ ${ createMdTable ( {
44984469 header : `
44994470 | Repository | Files | Sec | Kps | Rel | Trend Kps | N |
45004471 | ---------- | ----: | ---: | ---: | ----: | --------- | ----: |
45014472 ` ,
4502- rows
4503- } ) ;
4504- return inject `
4505- ## Data Throughput
4506-
4507- ${ table }
4473+ rows : data . map ( ( [ repo , records ] , i ) => {
4474+ const { point, count, trend, min, avg } = stats [ i ] ;
4475+ const trendGraph = simpleHistogram ( trend , min * .9 ) ;
4476+ const relChange = ( 100 * ( point - avg ) / ( avg || 1 ) ) . toFixed ( 2 ) + "%" ;
4477+ const lastRecord = records [ records . length - 1 ] ;
4478+ const mps = fn ( lastRecord ) ;
4479+ const elapsed = lastRecord . elapsedMs ;
4480+ const nFiles = lastRecord . files . toFixed ( 0 ) ;
4481+ return [
4482+ sub ( repo ) ,
4483+ nFiles ,
4484+ s ( elapsed , 2 ) ,
4485+ mps . toFixed ( 2 ) ,
4486+ relChange ,
4487+ `\`${ trendGraph } \`` ,
4488+ count
4489+ ] ;
4490+ } )
4491+ } ) }
45084492 ` ;
45094493}
45104494const monthNames = [
@@ -4529,15 +4513,14 @@ function createDailyPerfGraph(dailyStats) {
45294513 } ) ) ) , "repo" ) ] . map ( ( [ _repo , records ] ) => {
45304514 return `line [${ records . map ( ( r ) => r . fps . toFixed ( 2 ) ) . join ( ", " ) } ]` ;
45314515 } ) ;
4532- const xAxis = dailyStats . map ( ( d ) => `${ monthNames [ d . date . getUTCMonth ( ) ] } -${ d . date . getUTCDate ( ) } ` ) ;
45334516 return inject `
45344517 ## Daily Performance
45354518
45364519 ${ "```mermaid" }
45374520 xychart-beta
45384521 title Files Per Second by Day
45394522 y-axis Files per Second
4540- x-axis Date [${ xAxis . join ( ", " ) } ]
4523+ x-axis Date [${ dailyStats . map ( ( d ) => ` ${ monthNames [ d . date . getUTCMonth ( ) ] } - ${ d . date . getUTCDate ( ) } ` ) . join ( ", " ) } ]
45414524 bar [${ bar . join ( ", " ) } ]
45424525 ${ lines . join ( "\n" ) }
45434526 ${ "```" }
0 commit comments