Skip to content

Refactor to use search instead of hash tables #3

@cryptoquick

Description

@cryptoquick

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions