diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 000000000..51d030b2b --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,53 @@ +name: CodSpeed + +on: + push: + branches: + - main + pull_request: + # `workflow_dispatch` allows CodSpeed to trigger backtest + # performance analysis in order to generate initial data. + workflow_dispatch: + +permissions: + contents: read + id-token: write # for OpenID Connect authentication with CodSpeed + +env: + CARGO_TERM_COLOR: always + +jobs: + benchmarks: + name: Run benchmarks + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v7 + + - name: Install system dependencies + run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config + + - name: Install Rust toolchain + run: rustup update stable && rustup default stable + + - name: Cache build artifacts + uses: Swatinem/rust-cache@v2.9.1 + with: + cache-bin: "false" + prefix-key: "v1-codspeed" + + - name: Install cargo-codspeed + uses: taiki-e/install-action@v2 + with: + tool: cargo-codspeed + + - name: Build the benchmark target(s) + run: | + cargo codspeed build -m simulation -p documenting + cargo codspeed build -m simulation -p tests-compatibility --bench parsing --bench stabilizing + + - name: Run the benchmarks + uses: CodSpeedHQ/action@v4 + with: + mode: simulation + run: cargo codspeed run -m simulation -p documenting -p tests-compatibility diff --git a/Cargo.lock b/Cargo.lock index 6ec1e69e8..2b309894a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,6 +139,15 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "arrayvec" version = "0.5.2" @@ -427,12 +436,79 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +[[package]] +name = "codspeed" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7083f253260bcb4aaa3b4aa4c52973703dabc1a85c2f193997e2689aafa8a919" +dependencies = [ + "anyhow", + "cc", + "colored", + "getrandom 0.4.3", + "glob", + "libc", + "nix", + "serde", + "serde_json", + "statrs", +] + +[[package]] +name = "codspeed-criterion-compat" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f24251445188c69d50f10179d795424bd71b533b7e3f84fc03f26893b01af0" +dependencies = [ + "clap", + "codspeed", + "codspeed-criterion-compat-walltime", + "colored", + "regex", +] + +[[package]] +name = "codspeed-criterion-compat-walltime" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c38205d56e2cb4fe04b708de7f9653a3f1b89edbe3a20b28f21e9e525e9e061" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "codspeed", + "criterion-plot", + "is-terminal", + "itertools 0.10.5", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "colored" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "compiler-scripts" version = "0.1.0" @@ -490,29 +566,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "criterion" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf7af66b0989381bd0be551bd7cc91912a655a58c6918420c9527b1fd8b4679" -dependencies = [ - "anes", - "cast", - "ciborium", - "clap", - "criterion-plot", - "itertools 0.13.0", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_json", - "tinytemplate", - "walkdir", -] - [[package]] name = "criterion-plot" version = "0.5.0" @@ -642,7 +695,7 @@ dependencies = [ name = "documenting" version = "0.1.0" dependencies = [ - "criterion", + "codspeed-criterion-compat", "indexing", "insta", "lexing", @@ -884,11 +937,22 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + [[package]] name = "git2" version = "0.20.4" @@ -969,6 +1033,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + [[package]] name = "http" version = "1.4.0" @@ -1248,6 +1318,17 @@ dependencies = [ "serde", ] +[[package]] +name = "is-terminal" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -1263,15 +1344,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.14.0" @@ -1331,9 +1403,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.178" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libgit2-sys" @@ -1529,6 +1601,18 @@ dependencies = [ "smallvec", ] +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -1920,6 +2004,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "radix_trie" version = "0.3.0" @@ -2377,6 +2467,16 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "statrs" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e" +dependencies = [ + "approx", + "num-traits", +] + [[package]] name = "string-interner" version = "0.20.0" @@ -2547,7 +2647,7 @@ dependencies = [ "building", "checking", "clap", - "criterion", + "codspeed-criterion-compat", "diagnostics", "files", "flate2", diff --git a/README.md b/README.md index fdd8efc49..88df87657 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@
a language implementation for PureScript
+ --- diff --git a/compiler-core/documenting/Cargo.toml b/compiler-core/documenting/Cargo.toml index d3b7a1ac9..e6265da2a 100644 --- a/compiler-core/documenting/Cargo.toml +++ b/compiler-core/documenting/Cargo.toml @@ -11,7 +11,7 @@ stabilizing = { version = "0.1.0", path = "../stabilizing" } syntax = { version = "0.1.0", path = "../syntax" } [dev-dependencies] -criterion = "0.6.0" +criterion = { version = "5.0.1", package = "codspeed-criterion-compat" } insta = "1.45.1" lexing = { path = "../lexing" } diff --git a/tests-compatibility/Cargo.toml b/tests-compatibility/Cargo.toml index 966f485c6..3b1b8ebc2 100644 --- a/tests-compatibility/Cargo.toml +++ b/tests-compatibility/Cargo.toml @@ -9,7 +9,6 @@ anyhow = "1" building = { version = "0.1.0", path = "../compiler-core/building" } checking = { version = "0.1.0", path = "../compiler-core/checking" } clap = { version = "4", features = ["derive"] } -criterion = { version = "0.6.0", features = ["html_reports"] } diagnostics = { version = "0.1.0", path = "../compiler-core/diagnostics" } files = { version = "0.1.0", path = "../compiler-core/files" } flate2 = "1" @@ -34,6 +33,7 @@ url = "2.5.7" walkdir = "2.5.0" [dev-dependencies] +criterion = { version = "5.0.1", package = "codspeed-criterion-compat", features = ["html_reports"] } tempfile = "3" [[bench]]