Skip to content
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

Added simple benchmark for if a rectangle fits inside another rectangle #269

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions benchmarks/core/fitsinside.bril
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ARGS: 12 4 5 13
@main (width1:int, height1:int, width2:int, height2:int){
output: bool = call @fitsInside width1 height1 width2 height2;
print output;
}

@fitsInside(w1: int, h1: int, w2: int, h2: int) : bool {
width_check: bool = le w1 w2;
height_check: bool = le h1 h2;
first_check: bool = and width_check height_check;
widthheight_check: bool = le w1 h2;
heightwidth_check: bool = le h1 w2;
second_check: bool = and widthheight_check heightwidth_check;
ret_val: bool = or first_check second_check;
ret ret_val;
}
1 change: 1 addition & 0 deletions benchmarks/core/fitsinside.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
true
1 change: 1 addition & 0 deletions benchmarks/core/fitsinside.prof
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
total_dyn_inst: 10
1 change: 1 addition & 0 deletions docs/tools/bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The current benchmarks are:
* `quadratic`: The [quadratic formula][qf], including a hand-rolled implementation of square root.
* `recfact`: Compute *n!* using recursive function calls.
* `rectangles-area-difference`: Output the difference between the areas of rectangles (as a positive value) given their respective side lengths.
* `fitsinside`: Output whether or not a rectangle fits inside of another rectangle given the width and height lengths.
* `relative-primes`: Print all numbers relatively prime to *n* using [Euclidean algorithm][euclidean_into].
* `riemann`: Prints the left, midpoint, and right [Riemann][riemann] Sums for a specified function, which is the square function in this benchmark.
* `sieve`: Print all prime numbers up to *n* using the [Sieve of Eratosthenes][sievee].
Expand Down