RoaringBitmap / RoaringBitmap/roaring

CRoaring uses 4-wise binary search, experiments in Go roaring

Open
#147 0 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

In C, this binary search function proved useful...

static void binarySearch4(const uint16_t *array, int32_t n, uint16_t target1,
                   uint16_t target2, uint16_t target3, uint16_t target4,
                   int32_t *index1, int32_t *index2, int32_t *index3,
                   int32_t *index4) {
  const uint16_t *base1 = array;
  const uint16_t *base2 = array;
  const uint16_t *base3 = array;
  const uint16_t *base4 = array;
  if (n == 0)
    return;
  while (n > 1) {
    int32_t half = n >> 1;
    base1 = (base1[half] < target1) ? &base1[half] : base1;
    base2 = (base2[half] < target2) ? &base2[half] : base2;
    base3 = (base3[half] < target3) ? &base3[half] : base3;
    base4 = (base4[half] < target4) ? &base4[half] : base4;
    n -= half;
  }
  *index1 = (*base1 < target1) + base1 - array;
  *index2 = (*base2 < target2) + base2 - array;
  *index3 = (*base3 < target3) + base3 - array;
  *index4 = (*base4 < target4) + base4 - array;
}

https://github.com/RoaringBitmap/CRoaring/blob/master/src/array_util.c#L695-L717

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

The issue points to CRoaring's src/array_util.c lines 695-717 and provides a C binarySearch4 implementation. Start by locating the corresponding search logic in the Go roaring code and confirm the intended integration and benchmark expectations with maintainers. Done means the agreed approach is implemented in Go and the relevant tests or benchmarks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, go
Domain
performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.