I have a large set of fixed length arrays of bytes, something like e.g.:
type Fixed [64]byte
set := make([]Fixed, 10240)
Most of this entries have distinct 5-7 byte prefix. How I can implement efficient way to find elements of set
based on given prefix? e.g.:
set.Find([7]byte{ /*...*/ }) == /* no hit || single hit || multiple hit */
Looks like you need a trie.
You can store your set as a trie and given a prefix you go all the way down and get to a node. Then you just traverse the subtree rooted at this node to get all your items.
As mention above trie can be good for you. Also you can use hash table, the key will be the first 7-8 bytes (can use long for it), the access time is O(1) and I think is simpler to implement.