|
| 1 | +define download_latest_bench_asset |
| 2 | +ASSET_NAME=$(1) SAVE_AS=$(2) ruby benchmark/download_asset.rb |
| 3 | +endef |
| 4 | + |
| 5 | +benchmark/download: |
| 6 | + @echo "Downloading repos.zip..." |
| 7 | + $(call download_latest_bench_asset,repos.zip,benchmark/repos.zip) |
| 8 | + @echo "Unpacking repos.zip..." |
| 9 | + unzip --help |
| 10 | + ls -l benchmark/repos.zip |
| 11 | + unzip -q benchmark/repos.zip -d benchmark |
| 12 | + |
| 13 | + @echo "Downloading Rust parser..." |
| 14 | + $(call download_latest_bench_asset,$(BENCHMARK_RUNNER_ASSET_NAME),benchmark/rust-parser) |
| 15 | + chmod +x benchmark/rust-parser |
| 16 | + |
| 17 | + @echo "Downloading Ruby parser..." |
| 18 | + $(call download_latest_bench_asset,ruby-parser.rb,benchmark/ruby-parser.rb) |
| 19 | + |
| 20 | +BENCHMARK_ASSETS = \ |
| 21 | + benchmark/repos \ |
| 22 | + benchmark/filelist \ |
| 23 | + benchmark/repos.zip \ |
| 24 | + benchmark/ruby-parser.rb \ |
| 25 | + benchmark/rust-parser \ |
| 26 | + benchmark/stats |
| 27 | + |
| 28 | +benchmark/clear: |
| 29 | + rm -rf $(BENCHMARK_ASSETS) |
| 30 | + |
| 31 | +define run_benchmark |
| 32 | +cd benchmark && FILELIST_PATH=filelist $(1) |
| 33 | +endef |
| 34 | + |
| 35 | +benchmark/compare: |
| 36 | + $(call run_benchmark, ./rust-parser) |
| 37 | + $(call run_benchmark, ruby ruby-parser.rb) |
| 38 | + $(call run_benchmark, NODE_DISABLE_COLORS=1 node node-wasm-parser.js) |
| 39 | + |
| 40 | +BENCHMARK_RECORDING = $(TARGET).benchmark-out |
| 41 | +benchmark/record: |
| 42 | + echo "Rust:" > $(BENCHMARK_RECORDING) |
| 43 | + $(call run_benchmark, ./rust-parser >> ../$(BENCHMARK_RECORDING)) |
| 44 | + echo "Ruby:" >> $(BENCHMARK_RECORDING) |
| 45 | + $(call run_benchmark, ruby ruby-parser.rb >> ../$(BENCHMARK_RECORDING)) |
| 46 | + echo "WASM (Node.js):" >> $(BENCHMARK_RECORDING) |
| 47 | + $(call run_benchmark, NODE_DISABLE_COLORS=1 node node-wasm-parser.js >> ../$(BENCHMARK_RECORDING)) |
0 commit comments