diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-29 13:23:31 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-29 13:42:37 +0100 |
| commit | b70ee41c5c3aebd36190aa1508368a9bc287fb21 (patch) | |
| tree | be51d863129204f269c83a5d0b59f62839c80d3a /util/libreboot-utils/lottery.c | |
| parent | cec3de5c9eacb92e45fcd4ff88998d9b35e38663 (diff) | |
hexdump performance test, part 1
spoiler alert: it's slow as molasses
part 2 will be presented at a later date
(yes, please don't fill 8GB of memory with
random data and hexdump it)
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lottery.c')
| -rw-r--r-- | util/libreboot-utils/lottery.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/util/libreboot-utils/lottery.c b/util/libreboot-utils/lottery.c index 4c7c145a..fd39c68c 100644 --- a/util/libreboot-utils/lottery.c +++ b/util/libreboot-utils/lottery.c @@ -18,6 +18,7 @@ main(int argc, char **argv) { int same = 0; char *buf; + size_t size = 8589934592; (void) argc, (void) argv; (void) errhook(exit_cleanup); @@ -26,12 +27,12 @@ main(int argc, char **argv) /* https://man.openbsd.org/pledge.2 */ xpledgex("stdio", NULL); - buf = rmalloc(BUFSIZ); - if (!memcmp(buf, buf + (BUFSIZ >> 1), BUFSIZ >> 1)) + buf = rmalloc(size); + if (!memcmp(buf, buf + (size >> 1), size >> 1)) same = 1; if (argc < 2) /* no spew */ - spew_hex(buf, BUFSIZ); + spew_hex(buf, size); free_and_set_null(&buf); fprintf(stderr, "\n%s\n", same ? "You win!" : "You lose!"); |
