Skip to content

Commit

Permalink
Fix performance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ParfenovIgor committed Jan 4, 2025
1 parent b89951e commit 05b1a50
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/perf/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ALFLAGS=-i altlib ../../altlib/
CFLAGS=-O2 -g -fno-stack-protector -I include -I ../../stdlib/include
CFLAGS=-g -fno-stack-protector -I include -I ../../stdlib/include
LDFLAGS=-z noexecstack

SRCS_AL := $(wildcard *.al)
Expand Down
8 changes: 8 additions & 0 deletions test/perf/merge_sort.al
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ func ^._start() -> #V {
}

eval merge_sort(a, 0, n, allocator&)

i := 0
eval while (i + 1 < n) {
eval if (a[i] > a[i + 1]) {
eval posix_exit(1)
}
i := i + 1
}

eval posix_exit(0)
}
7 changes: 6 additions & 1 deletion test/perf/merge_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ int main() {
}

merge_sort(a, 0, n);
for(int i=0;i<n;i++) _puti(a[i]);

for (int i = 0; i + 1 < n; i++) {
if (a[i] > a[i + 1]) {
return 1;
}
}

return 0;
}

0 comments on commit 05b1a50

Please sign in to comment.