Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build word lists into executables #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cusiman7
Copy link

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.

@mas-4
Copy link

mas-4 commented Oct 20, 2022

Hahaha, you beat me to it, I just made a comment this morning suggesting that in an issue #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.

@cusiman7
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants