Fastest way to check if initial commit? #14
-
"Determine whether the key was inserted by comparing the table's size before and after the call." My use case is that I have a stream of c strings which effectively need to dedup. I can only have 1 output regardless of the number of inputs of that particular string. I've been using khash which will indicate in the return value whether or not the insert was new or overwrite. Is the above the best way to do the same with verstable? Is the cost of looking up table size 2x sufficiently small to make that a reasonable pattern? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi!
Yes, that's the intended usage. It's a bit clunky, but when designing the API, I thought this approach was better than the alternatives (namely returning a struct or requiring users to pass in pointer to a
Yes. Verstable tracks the current number of keys currently in the hash table, so the |
Beta Was this translation helpful? Give feedback.
Hi!
Yes, that's the intended usage. It's a bit clunky, but when designing the API, I thought this approach was better than the alternatives (namely returning a struct or requiring users to pass in pointer to a
bool
even though they might not need this information).Yes. Verstable tracks the current number of keys currently in the hash table, so the
_size
function just returns that value. The only reasons that there is a function to retrieve this value are, firstly, API consistency and, secondly, to keep the struct members an implementat…