Skip to content

Commit

Permalink
refactor: guard benchmark against empty input code when reparsing
Browse files Browse the repository at this point in the history
  • Loading branch information
EagleoutIce committed Aug 4, 2023
1 parent 7b6dc66 commit bb856d5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/benchmark/stats/summarizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,21 @@ export async function summarizeSlicerStats(stats: SlicerStats, report: (criteria
dataflowNodes: perSliceStat.numberOfDataflowNodesSliced
}))
} catch(e: unknown) {
console.error(` ! Failed to re-parse the output of the slicer for ${JSON.stringify(criteria)}`) //, e
console.error(` Code: ${output}\n`)
failedOutputs++
if(output.length === 0) {
reductions.push(calculateReductionForSlice(stats.input, stats.dataflow, {
lines: lines,
characters: output.length,
nonWhitespaceCharacters: nonWhitespace,
autoSelected: autoSelected,
tokens: 0,
normalizedTokens: 0,
dataflowNodes: perSliceStat.numberOfDataflowNodesSliced
}))
} else {
console.error(` ! Failed to re-parse the output of the slicer for ${JSON.stringify(criteria)}`) //, e
console.error(` Code: ${output}\n`)
failedOutputs++
}
}

sliceSize.dataflowNodes.push(perSliceStat.numberOfDataflowNodesSliced)
Expand Down

0 comments on commit bb856d5

Please sign in to comment.