standup5x5
standup5x5 copied to clipboard
Build word lists into executables
Just saw Matt Parker's latest video yesterday. Figured I'd contribute in my own small way. This change saves about ~200 microseconds on my machine during "File Load".
- Added a little C++ program to generate headers from the 3 existing wordlists.
- Makefile is updated to build this program and generate the headers.
- utilities.h includes these headers and avoids reading these 3 files from disk with mmap fallback if it's a novel file.
- A bunch of const changes to utilities.h as we're now reading static data.
- Makefile is updated to use just
clang
as I don't have "clang-13" on my path - CC and CXX are now taken from env. You can run
CC=clang-13 make
to change the compiler.
Hahaha, you beat me to it, I just made a comment this morning suggesting that in an issue https://github.com/stew675/standup5x5/issues/3 and was literally just opening the code to see what I could do.
Strangely, yours seems slower on my machine. This is running v25.
Model name: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
and an nvme drive. Arch linux.
Dynamically building the header at build time is really clever btw.
@mas-4 I've found the first run is slow, probably because the executable is 4MB now. Once the executable itself is cached by the OS subsequent runs are much faster. Not a compete win but it's also hard to account for. i.e. The original v25 is probably mmap'ing a cached file. Could also be OS differences though? I'm on a MacBook personally.