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

Refactor to use search instead of hash tables #3

Open
cryptoquick opened this issue Aug 29, 2023 · 0 comments
Open

Refactor to use search instead of hash tables #3

cryptoquick opened this issue Aug 29, 2023 · 0 comments

Comments

@cryptoquick
Copy link
Owner

Hash tables are large and must be persisted in memory. Further, all these tables are computed at runtime on the heap. This won't scale as more languages are added. Ideally as much is done in the stack as possible.

A naive linear search should be implemented that does not split by whitespace.

An alternative, a build script to format the words file as a static Rust file with a hardcoded lookup table, was considered, but this will still take up more memory compared to a string. Considering this lookup needs to happen rarely, while the table will be in-memory for the duration of the program, it's best to optimize for space at the cost of time in this case.

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

No branches or pull requests

1 participant