mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-19 00:03:45 +02:00
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>
This commit is contained in:
@@ -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!");
|
||||
|
||||
Reference in New Issue
Block a user