Skip to content

Used a shared reference for target hashes #33

@jdidion

Description

@jdidion

Thinking more about this - assume the default kmer size of 12. A kmer Vec<u8> (or ByteStr) is 16 bytes (12 u8s + a usize length), while a slice is 8 bytes (a usize pointer + a usize length). That means, with 2 or more threads, it consumes as much or more memory to build a separate set of target hashes for each thread, rather than build one and share it (behind an Arc). It would also make the API cleaner to use Vec<u8>/ByteStr keys as we can get rid of the lifetime parameter. I'm not sure if there will be any impact on performance.

We could also do something fancier - compute the key size (threads * 8 vs k + 4) to decide whether to use a single shared target hashes or one per thread, and put it behind e.g. a Cow (although then we need to keep the lifetime parameter).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions