File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 6161 node-version : 12.13.1
6262 # NPM
6363 - name : NPM master
64- # TODO Lua types is only added manually to test the benchmark PR this can be removed again once the PR is merged
65- run : npm ci && npm run build && npm install -D lua-types
64+ run : npm ci && npm run build
6665 working-directory : master
6766 - name : NPM commit
6867 run : npm ci && npm run build
@@ -112,7 +111,12 @@ jobs:
112111 const benchmarkInfoLua = JSON.parse(core.getInput('benchmark-info-lua', { required: true }));
113112 const benchmarkInfoJIT = JSON.parse(core.getInput('benchmark-info-jit', { required: true }));
114113
115- const summary = `### Lua5.3\n${benchmarkInfoLua.summary}\n### LuaJIT\n${benchmarkInfoJIT.summary}`;
114+ const zlib = require('zlib');
115+ const buffer = Buffer.from(core.getInput('benchmark-info-lua', { required: true }));
116+ const compressed = zlib.deflateSync(buffer);
117+
118+ const summary = `[Open visualizer](https://typescripttolua.github.io/benchviz?d=${compressed.toString('base64')})\n`
119+ + `### Lua5.3\n${benchmarkInfoLua.summary}\n### LuaJIT\n${benchmarkInfoJIT.summary}`;
116120
117121 const text = `### Lua5.3\n${benchmarkInfoLua.text}\n### LuaJIT\n${benchmarkInfoJIT.text}`;
118122
Original file line number Diff line number Diff line change @@ -27,11 +27,8 @@ function benchmark(): void {
2727 oldBenchmarkResults = json . decode ( oldBenchmarkData ) as BenchmarkResult [ ] ;
2828 }
2929
30- // Compare results
31- const comparisonInfo = compareBenchmarks ( oldBenchmarkResults , newBenchmarkResults ) ;
32-
3330 // Output comparison info
34- outputBenchmarkData ( comparisonInfo , newBenchmarkResults ) ;
31+ outputBenchmarkData ( oldBenchmarkResults , newBenchmarkResults ) ;
3532}
3633benchmark ( ) ;
3734
@@ -44,12 +41,14 @@ function compareBenchmarks(oldResults: BenchmarkResult[], newResults: BenchmarkR
4441 return { summary : memoryComparisonInfo . summary , text : memoryComparisonInfo . text } ;
4542}
4643
47- function outputBenchmarkData ( comparisonInfo : { summary : string ; text : string } , newResults : BenchmarkResult [ ] ) : void {
44+ function outputBenchmarkData ( oldResults : BenchmarkResult [ ] , newResults : BenchmarkResult [ ] ) : void {
4845 if ( ! arg [ 2 ] ) {
4946 // Output to stdout as json by default, this is used by the CI to retrieve the info
50- print ( json . encode ( comparisonInfo ) ) ;
47+ print ( json . encode ( { old : oldResults , new : newResults } ) ) ;
5148 } else {
5249 // Output to file as markdown if arg[2] is set, this is useful for local development
50+ // Compare results
51+ const comparisonInfo = compareBenchmarks ( oldResults , newResults ) ;
5352 const markdownDataFile = io . open ( arg [ 2 ] , "w+" ) [ 0 ] ! ;
5453 markdownDataFile . write ( comparisonInfo . summary + comparisonInfo . text ) ;
5554 }
You can’t perform that action at this time.
0 commit comments