Skip to content

Commit

Permalink
Improve BenchmarkInject script
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Oct 21, 2024
1 parent 622b843 commit 419888f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/BenchmarkInject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function run(args: Array<string>): void {

if (args.length !== 2 || elmFileRaw === undefined) {
throw new KnownError(
`You must pass the compilation mode as well as the path to a single Elm file.`,
`You must pass the compilation mode as well as the path to a single JS file of compiled Elm code.`,
);
}

Expand All @@ -38,10 +38,15 @@ function run(args: Array<string>): void {
const newCode = inject(compilationMode, code);
console.timeEnd("Run");

const oldLines = code.split("\n").length;
const newLines = newCode.split("\n").length;

console.log(
`Success! Before: ${code.length}. After: ${newCode.length}. Diff: ${
newCode.length - code.length
}`,
`
Success!
Lines before: ${oldLines}
Lines after: ${newLines}
Diff: ${newLines - oldLines}`,
);
}

Expand Down

0 comments on commit 419888f

Please sign in to comment.