Binary trie #89
Conversation
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Thomas Zamojski <thomas.zamojski@quadratic-labs.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
|
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
garyschulte
left a comment
There was a problem hiding this comment.
LGTM, some thoughts. Can approve to expedite
| /** | ||
| * The Hex+ string representation of the BitSequence. | ||
| * | ||
| * @return A byte array representation of the node. |
There was a problem hiding this comment.
nit. string representation of hex bytes of the BitSequence
There was a problem hiding this comment.
Yup, made a change.
| */ | ||
| @Override | ||
| public BytesPackedBitSequence add(int suffix, int width) { | ||
| // TODO: modify this. |
There was a problem hiding this comment.
modify how, by using width to mask some of the suffix?
| public class BytesBitSequence extends BitSequence<BytesBitSequence> { | ||
| private static final BytesBitSequenceFactory FACTORY = new BytesBitSequenceFactory(); | ||
|
|
||
| public final byte[] data; |
There was a problem hiding this comment.
how about java.util.BitSet ? would be more memory efficient
There was a problem hiding this comment.
Thought about BitSet, or similarly implementing flags with integers. However, there is a primary concern here: concatenating 2 sequences is a frequent operation. Not sure if it would be easy/readable/compute-efficient to concatenate BitSets, as opposed to boolean[].
So the idea: benchmark with the simple boolean[] solution first and see if there could be value to memory efficiency. Try other implementations if necessary like BitSets.
There was a problem hiding this comment.
boolean[] is a great idea to keep the existing implementation and be memory efficient 👍
| sb.append("."); // There is at least 1 remaining bit | ||
| } | ||
| for (int j = i; j < bitLength; j++) { | ||
| sb.append(get(i) ? '1' : '0'); |
|
@thomas-quadratic if you can take a look |
|
Ok, I merged @matkt fixes, and some docs. |
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
Signed-off-by: Karim Taam <karim.t2am@gmail.com>
|
Fixed another issue related to SHA256 on this PR. I think we should be good to check the last comment and merge this PR @thomas-quadratic @garyschulte |
PR description
Binary trie implementation by @thomas-quadratic with some fixes by @matkt
Fixed Issue(s)