Baqend / Orestes-Bloomfilter

Library of different Bloom filters in Java with optional Redis-backing, counting and many hashing options.
Other
839 stars 245 forks source link

allow control over which byte[] to hash to avoid unnecessary allocation + copy operations #69

Open talwgx opened 11 months ago

talwgx commented 11 months ago

It would be great if there was an overload for in: src/main/java/orestes/bloomfilter/BloomFilter.java : public boolean addRaw(byte[] element) where one could specify the start and len within the 'byte[] element', so that if a large buffer has already been allocated in memory, one can specify which portions within it are to be added to the filter. Currently a new byte[] of the correct length must be allocated and copied into each time, which forces unnecessary allocation + copy operations.

https://github.com/Baqend/Orestes-Bloomfilter/blob/933dded79f479dbb85e4e6fdec1e9ce76638aefe/src/main/java/orestes/bloomfilter/BloomFilter.java#L21