standup5x5 icon indicating copy to clipboard operation
standup5x5 copied to clipboard

Build word lists into executables

Open cusiman7 opened this issue 2 years ago • 2 comments

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.

cusiman7 avatar Oct 20 '22 19:10 cusiman7

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.

Screenshot_20221020_170622

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 avatar Oct 20 '22 21:10 mas-4

@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.

cusiman7 avatar Oct 20 '22 21:10 cusiman7