|
C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
|
Empirical comparison of all five sort algorithms. More...
Go to the source code of this file.
Classes | |
| struct | sort_entry_t |
Typedefs | |
| typedef void(* | sort_fn) (int *, size_t) |
Functions | |
| static void | fill_random (int *out, size_t n, unsigned seed) |
| int | main (void) |
| static double | time_sort_ms (sort_fn fn, int *arr, size_t n) |
Variables | |
| static const size_t | N_SIZES = sizeof(SIZES) / sizeof(SIZES[0]) |
| static const size_t | N_SORTS = sizeof(SORTS) / sizeof(SORTS[0]) |
| static const size_t | SIZES [] = {100, 1000, 10000} |
| static const sort_entry_t | SORTS [] |
Empirical comparison of all five sort algorithms.
For each of {100, 1000, 10000} random integers, run each sort against the same input and report wall-clock time in milliseconds. Output is a Markdown table so it can be pasted straight into READMEs.
Definition in file benchmark.c.
| typedef void(* sort_fn) (int *, size_t) |
Definition at line 16 of file benchmark.c.
|
static |
Fills out with n deterministically-shuffled integers in [0, n).
Definition at line 36 of file benchmark.c.
Referenced by main().
| int main | ( | void | ) |
Definition at line 50 of file benchmark.c.
References fill_random(), N_SIZES, N_SORTS, SIZES, SORTS, and time_sort_ms().
|
static |
Definition at line 41 of file benchmark.c.
Referenced by main().
Definition at line 33 of file benchmark.c.
Referenced by main().
Definition at line 30 of file benchmark.c.
Referenced by main().
|
static |
Definition at line 32 of file benchmark.c.
Referenced by main().
|
static |
Definition at line 23 of file benchmark.c.
Referenced by main().