-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: in-place bitwise operations #38
Comments
Can you show example of " a lot of tedious for loops to add or remove entries."? Also, if you do a graph - could this https://crates.io/crates/hibit_tree be more useful for you? You can use it as a Map<usize, Vert> and can do inter-set operations on it. It is faster then intesrsecting a set, and then accessing a HashMap by index. This would be a more or less https://docs.rs/hibit_tree/0.1.0-alpha.3/hibit_tree/struct.SparseTree.html equal to |
Mostly it's having to turn every
Neat! But not really relevant to my use case :) I'm storing vertices in a |
Ok - I'll see what I can do.
|
I'm computing dependency graphs from python code so the max index is basically the number of Python modules under consideration, which varies by repository. For the big repo that I'm focusing on right now that's ~70k
No. In my case, the index range is only known at run-time. While I have your attention and you're considering some changes, it would be nice to have some helper functions for serialization. Right now I'm doing the dumbest possible thing: storing each bitset as a length-prefixed sequence of varint, which means I need to iterate once to get the length with |
Are you aware of BitSet memory overhead? See memory layout scheme on doc's main page.
But the BitSet have limited range. It's depth always fixed, for performance. Currently there is 3 levels. And you can configure only block width. I'm talking about configuring it's depth as well. For example, if you would fit u16::MAX range - you could deal with 2level x 256bit configuration - that will both reduce hierarchy memory overhead and speed up all operations.
What is that?
There is currently no len counter at all. And it can be only implemented for physical BitSet (I mean not for the lazy-one, like If you actually need len in BitSet specifically - yes I can add that. Make an separate issue if that so - I may forget that.
You CAN iterate over datablocks now https://docs.rs/hi_sparse_bitset/0.6.1/hi_sparse_bitset/#datablocks with https://docs.rs/hi_sparse_bitset/0.6.1/hi_sparse_bitset/trait.BitSetInterface.html#method.block_iter. It returns https://docs.rs/hi_sparse_bitset/0.6.1/hi_sparse_bitset/struct.DataBlock.html . You should be able to serialize it. The problem is that there is no interface for pushing blocks for efficient deserialization. This I can add. |
Yeah, I went with the
https://protobuf.dev/programming-guides/encoding/#varints
Honestly, the only reason I need the length right now is as an implementation detail for serialization, and sometimes for debug printing so not a huge deal if there is a better serialization option
That would be great! |
I'm doing some graph manipulation, with the graph being represented by adjacency list, where each vertex is an integer. Using BitSet as a replacement for
HashSet<usize>
is making things considerably faster, however the inability to do in-place bitwise operations on BitSet is really annoying and forcing me to do a lot of tediousfor
loops to add or remove entries.The text was updated successfully, but these errors were encountered: