-
Notifications
You must be signed in to change notification settings - Fork 318
Speeding up Brilirs #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Speeding up Brilirs #122
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a4f7af9
benchmarking, removing clones, and fxhashmap
Pat-Lafon 7d3e1cb
Slightly better allocator
Pat-Lafon 933db48
Do typechecking seperately and use nightly
Pat-Lafon 63ebc65
--check arg and fmt check.rs
Pat-Lafon 4b2d5ed
bump clap version
Pat-Lafon e913e0b
unsafe_unreachable and reference fixes
Pat-Lafon 1a84603
Use ints for variable names
Pat-Lafon c1094d6
Slightly improved error messages
Pat-Lafon c0853a9
Some comments and documentation
Pat-Lafon f4b5be7
document --check
Pat-Lafon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| command = "bril2json < {filename} | cargo run --manifest-path ../brilirs/Cargo.toml --quiet -- -p {args}" | ||
| command = "bril2json < {filename} | cargo +nightly run --manifest-path ../brilirs/Cargo.toml --quiet -- -p {args}" | ||
| output.out = "-" | ||
| output.prof = "2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| files=( "../benchmarks/ackermann.bril" "../benchmarks/binary-fmt.bril" "../benchmarks/check-primes.bril" \ | ||
| "../benchmarks/collatz.bril" "../benchmarks/digital-root.bril" "../benchmarks/eight-queens.bril" \ | ||
| "../benchmarks/euclid.bril" "../benchmarks/fib.bril" "../benchmarks/fizz-buzz.bril" \ | ||
| "../benchmarks/gcd.bril" "../benchmarks/loopfact.bril" "../benchmarks/mat-mul.bril" \ | ||
| "../benchmarks/orders.bril" "../benchmarks/perfect.bril" "../benchmarks/pythagorean_triple.bril" \ | ||
| "../benchmarks/quadratic.bril" "../benchmarks/ray-sphere-intersection.bril" \ | ||
| "../benchmarks/recfact.bril" "../benchmarks/sieve.bril" "../benchmarks/sqrt.bril" \ | ||
| "../benchmarks/sum-bits.bril" "../benchmarks/sum-sq-diff.bril" | ||
| ) | ||
| jsons=( "../benchmarks/ackermann.json" "../benchmarks/binary-fmt.json" "../benchmarks/check-primes.json" \ | ||
| "../benchmarks/collatz.json" "../benchmarks/digital-root.json" "../benchmarks/eight-queens.json" \ | ||
| "../benchmarks/euclid.json" "../benchmarks/fib.json" "../benchmarks/fizz-buzz.json" \ | ||
| "../benchmarks/gcd.json" "../benchmarks/loopfact.json" "../benchmarks/mat-mul.json" \ | ||
| "../benchmarks/orders.json" "../benchmarks/perfect.json" "../benchmarks/pythagorean_triple.json" \ | ||
| "../benchmarks/quadratic.json" "../benchmarks/ray-sphere-intersection.json" \ | ||
| "../benchmarks/recfact.json" "../benchmarks/sieve.json" "../benchmarks/sqrt.json" \ | ||
| "../benchmarks/sum-bits.json" "../benchmarks/sum-sq-diff.json" | ||
| ) | ||
| args=( "3 6" "128" "50" "7" "645634654" "8" "" "10" "101" "4 20" "8" "50 109658" "96 false" "496" "125" \ | ||
| "-5 8 21" "" "8" "100" "" "42" "100") | ||
|
|
||
| for i in "${!files[@]}"; do | ||
| bril2json < ${files[i]} > ${jsons[i]} | ||
|
|
||
| export json=${jsons[i]} | ||
| export arg=${args[i]} | ||
| echo "file is ${files[i]}" | ||
| echo "arg is $arg" | ||
| hyperfine --warmup 5 -L interp brili,./target/release/brilirs '{interp} -p $arg < $json' | ||
|
|
||
| rm ${jsons[i]} | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Some ideas for faster code | ||
| # Feature gate type checking? | ||
|
|
||
| files=( "../benchmarks/ackermann.bril" "../benchmarks/eight-queens.bril" \ | ||
| "../benchmarks/mat-mul.bril" | ||
|
|
||
| ) | ||
| jsons=( "../benchmarks/ackermann.json" "../benchmarks/eight-queens.json" \ | ||
| "../benchmarks/mat-mul.json" | ||
|
|
||
| ) | ||
| args=( "3 6" "8" "50 109658") | ||
|
|
||
| for i in "${!files[@]}"; do | ||
| bril2json < ${files[i]} > ${jsons[i]} | ||
|
|
||
| export json=${jsons[i]} | ||
| export arg=${args[i]} | ||
| echo "file is ${files[i]}" | ||
| echo "arg is $arg" | ||
| hyperfine --warmup 5 -L interp brili,./target/release/brilirs '{interp} -p $arg < $json' | ||
|
|
||
| rm ${jsons[i]} | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a little bit too bad that this script needs to re-list all the benchmarks and all their arguments instead of just using
../benchmarks/*.bril. Maybe Brench could help with this—it could even wrap a call to Hyperfine? Not sure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't really tried to use Brench yet but I will look into it. I was mostly going off of the blog post so I threw something together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The closest I've gotten is the following one-liner as a single stage pipeline for brench.
(export bril=$(bril2json </dev/stdin); export arg='3 6'; hyperfine -s basic --warmup 5 'echo $bril | brili -p $arg')where I'm only trying to get theAckermann.brilbenchmark to run. I get a niceValueError: I/O operation on closed file.when running Brench which I'm unsure of. It runs as expected on it's own(providing the ackermann file to stdin).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird. Any chance it's a bash/sh difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to show the above line using /bin/sh and running without issue.