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

Add IsDecreasing benchmark #280

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
47 changes: 47 additions & 0 deletions benchmarks/core/is-decreasing.bril
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Input: an array of length 6
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like this may be out of date? The input appears to be an integer, not an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops good catch. Just fixed this!

# Output: if an number contains digits in strictly decreasing order
# ARGS: 954320
@main(x: int) {
tmp0: bool = call @is_decreasing x;
tmp: bool = id tmp0;
print tmp;
}
@is_decreasing(x: int): bool {
tmp: int = id x;
tmp1: int = const 1;
tmp2: int = const -1;
tmp3: int = mul tmp1 tmp2;
prev: int = id tmp3;
.label4:
tmp7: int = const 0;
tmp8: bool = gt tmp tmp7;
br tmp8 .label5 .label6;
.label5:
tmp9: int = call @last_digit tmp;
digit: int = id tmp9;
tmp10: bool = lt digit prev;
br tmp10 .label11 .label12;
.label11:
tmp14: bool = const false;
ret tmp14;
jmp .label13;
.label12:
jmp .label13;
.label13:
prev: int = id digit;
tmp15: int = const 10;
tmp16: int = div tmp tmp15;
tmp: int = id tmp16;
jmp .label4;
.label6:
tmp17: bool = const true;
ret tmp17;
}
@last_digit(x: int): int {
tmp18: int = const 10;
tmp19: int = div x tmp18;
tmp20: int = const 10;
tmp21: int = mul tmp19 tmp20;
tmp22: int = sub x tmp21;
ret tmp22;
}
1 change: 1 addition & 0 deletions benchmarks/core/is-decreasing.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
true
1 change: 1 addition & 0 deletions benchmarks/core/is-decreasing.prof
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
total_dyn_inst: 127
1 change: 1 addition & 0 deletions docs/tools/bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The current benchmarks are:
* `function_call`: For benchmarking the overhead of simple function calls.
* `gcd`: Calculate Greatest Common Divisor (GCD) of two input positive integer using [Euclidean algorithm][euclidean_into].
* `hanoi`: Print the solution to the *n*-disk [Tower of Hanoi][hanoi] puzzle.
* `is-decreasing`: Print if a number contains strictly decreasing digits.
* `loopfact`: Compute *n!* imperatively using a loop.
* `mandelbrot`: Generates a really low resolution, ascii, [mandelbrot set][mandelbrot].
* `mat-inv` : Calculates the inverse of a 3x3 matrix and prints it out.
Expand Down