Comments (4)
Good day,
They approach you describe would work. It should be reasonably fast.
It is clearly not optimal since it requires creating a new input object and then outputting yet another object. So, at a minimum, you have more memory allocations than you would like.
It is be possible to extend slightly the API to support your need, if it is in a performance-critical component of your code. I would be glad to implement this feature for you. It is not very hard to do. (You might even be able to do it on your own.) Of course, before I do so, I'd be interested in knowing more about your context as it is possible that this is not the right solution to your real problem.
- Daniel
from roaring.
Hi Daniel,
thank you very much for the reply. Much appreciated!
My use case, in detail, is:
I have a PublicKey type which is a 32 bytes long Go array. A slice of PublicKeys is maintained. The index of each PublicKey is important and can never change. Rarely, a PublicKey might need to be deleted, but the index of the following PublicKeys must remain the same.
To make this efficient, it seems sensible to keep track of these garbage ids in a compressed bitset. If PublicKey i is deleted, then position i in the bitset is set. If PublicKey with index i is subsequently requested, the bitset is first consulted for a count of set bits below i and PublicKey with position i-count is returned from the slice. The bitset is effectively a concise way to preserve the deleted ids and get the correct PublicKey from the slice after deletions have occurred.
Hope that makes sense! I want to use a slice of PublicKeys, rather than a tree structure to minimise overall memory usage.
Any advice or extensions to the API would be very gratefully received :-)
from roaring.
Ok. I have added a Rank function. It should do what you seek.
(The technical term describing what I think you want is "rank".)
I am closing this. If it is not what you were seeking or if the implementation is faulty, please reopen.
from roaring.
Many thanks, looks like exactly what I need, will test and report back if any issues.
Much appreciated!
from roaring.
Related Issues (20)
- upper bound memory estimate HOT 3
- question: what is Freeze? HOT 2
- Failed to read runtime container content: unexpected EOF HOT 1
- External-memory roaring data structure HOT 2
- Add Bitmap.NextAbsentValue HOT 5
- error in roaringArray.readFrom: could not read initial cookie: unexpected EOF HOT 7
- [roaring64] Why Or function modify bitmap "a" in this example? HOT 7
- Regarding memory use of maximum size and removal of bit number HOT 2
- UnmarshalBinary has containers with needCopyOnWrite set to true HOT 1
- Implement roaring_bitmap_internal_validate HOT 2
- error in roaringArray.readFrom: did not find expected serialCookie in header HOT 2
- "error in roaringArray.readFrom: did not find expected serialCookie in header" HOT 4
- make qa fails for release 1.6.0
- incorrect GetSizeInBytes() value HOT 1
- "error in roaringArray.readFrom: did not find expected serialCookie in header" when reading a bitmap written by roaring64 HOT 5
- "Could not deserialize bitmap for key #0: error in roaringArray.readFrom: did not find expected serialCookie in header" on v1.8.0 when reading a bitmap written by roaring64 HOT 1
- Go get error HOT 2
- Feature request : mmap roaring bitmap for use in multi threaded inter-process/separate program HOT 1
- Feature request for 128bit for ipv6 usage. HOT 3
- possible to do an mmap version of roaring bitmap for golang? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roaring.