RoaringBitmap / RoaringBitmap/roaring

WriteTo() optimization ideas?

Open
#163 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted performance
Dominant language
Go
Stars
2.9k
Forks
262
Avg merge
2h 34m
Merged PRs (30d)
8

Description

It appears the current implementation of Bitmap.WriteTo() isn't very much different than the user instead calling ToBytes() and invoking io.Writer.Write() itself...
https://github.com/RoaringBitmap/roaring/blob/master/roaringarray.go#L526

Was wondering if there are approaches or ideas that might help avoid the "extra" toBytes() allocation?

I'd be willing to give an improvement an attempt if it's pretty straightforward. In my usage of roaring in a golang full-text engine (blevesearch), the io.Writer that we're using is one of those bufio buffered writers, so the guess would be that a bunch of Write()'s ought to be ok.

cheers,
steve

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read roaringarray.go around line 526 and compare Bitmap.WriteTo() with ToBytes() followed by io.Writer.Write(). Establish whether the writer path can avoid the extra allocation without changing serialized output, then validate the result with an allocation or throughput comparison.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.