Skip to content

Commit

Permalink
Merge pull request #580 from candy-lang/golden-tests
Browse files Browse the repository at this point in the history
Golden tests
  • Loading branch information
JonasWanke authored Aug 3, 2023
2 parents fc2d5a7 + 3ac49ca commit 557f7a5
Show file tree
Hide file tree
Showing 100 changed files with 31,669 additions and 49 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/compiler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

# Core
- name: 'Core: run'
run: cargo run --release -- check packages/Core/_.candy
run: cargo run --release -- check ./packages/Core/_.candy

# fuzzing:
# name: Fuzzing
Expand All @@ -34,7 +34,18 @@ jobs:
# - uses: dsherret/rust-toolchain-file@v1
# - uses: Swatinem/[email protected]

# - run: cargo run --release -- fuzz packages/Benchmark.candy
# - run: cargo run --release -- fuzz ./packages/Benchmark.candy

check-goldens:
name: Check Golden IR Files
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/[email protected]

- name: Check Goldens
run: cargo run --release -- debug gold check ./packages/Examples/

benchmark:
name: Benchmark
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: PR

on: pull_request_target
on:
pull_request_target:
types:
- opened
- ready_for_review
- synchronize

jobs:
add-labels:
Expand All @@ -23,7 +28,7 @@ jobs:
- uses: technote-space/[email protected]

automerge-pr:
if: github.event.action == 'opened'
if: (github.event.action == 'opened' && !github.event.pull_request.draft) || github.event.action == 'ready_for_review'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"request": "launch",
"preLaunchTask": "Compiler: Build (debug)",
"program": "${workspaceRoot}/target/debug/candy",
"args": ["run", "packages/examples/fibonacci.candy"],
"args": ["run", "packages/Examples/fibonacci.candy"],
"cwd": "${workspaceRoot}"
}
]
Expand Down
33 changes: 29 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions compiler/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ candy_language_server = { path = "../language_server" }
candy_vm = { path = "../vm" }
clap = { version = "4.1.8", features = ["derive"] }
colored = "2.0.0"
diffy = "0.3.0"
itertools = "0.11.0"
lazy_static = "1.4.0"
notify = "5.1.0"
notify-debouncer-mini = { version = "0.2.1", default-features = false }
regex = "1.9.1"
rustc-hash = "1.1.0"
salsa = "0.16.1"
tokio = { version = "1.24.2", features = ["full"] }
tower-lsp = "0.19.0"
tracing = { version = "0.1", features = ["release_max_level_debug"] }
tracing-subscriber = { version = "0.3.16", features = ["registry"] }
walkdir = "2.3.2"
4 changes: 2 additions & 2 deletions compiler/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Create a [flamegraph](https://github.com/flamegraph-rs/flamegraph#readme):
```bash
cargo flamegraph --bin=candy --deterministic --output=<output file name> -- run <candy file>
# For example:
cargo flamegraph --bin=candy --deterministic --output=flamegraph.svg -- run packages/examples/fibonacci.candy
cargo flamegraph --bin=candy --deterministic --output=flamegraph.svg -- run packages/Examples/fibonacci.candy
```

Use [hyperfine](https://github.com/sharkdp/hyperfine#readme):

```bash
hyperfine --warmup 1 "cargo run --release -- run <candy file>"
# For example:
hyperfine --warmup 1 "cargo run --release -- run packages/examples/fibonacci.candy"
hyperfine --warmup 1 "cargo run --release -- run packages/Examples/fibonacci.candy"
```
Loading

1 comment on commit 557f7a5

@jwbot
Copy link
Collaborator

@jwbot jwbot commented on 557f7a5 Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiler

Benchmark suite Current: 557f7a5 Previous: 6d579c2 Ratio
Time: Compiler/hello_world 24455468 ns/iter (± 555349) 22075100 ns/iter (± 349299) 1.11
Time: Compiler/fibonacci 198992549 ns/iter (± 4270779) 176486071 ns/iter (± 1320730) 1.13
Time: VM Runtime/hello_world 65404 ns/iter (± 6839) 68001 ns/iter (± 3600) 0.96
Time: VM Runtime/fibonacci/15 454176201 ns/iter (± 7372299) 495027299 ns/iter (± 2346414) 0.92
Time: VM Runtime/PLB/binarytrees/6 2031122249 ns/iter (± 20507076) 2253706348 ns/iter (± 8215159) 0.90

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.