git/ewah
Taylor Blau 5551ccfe97 ewah: implement `struct ewah_or_iterator`
While individual bitmap layers store different commit, type-level, and
pseudo-merge bitmaps, only the top-most layer is used to compute
reachability traversals.

Many functions which implement the aforementioned traversal rely on
enumerating the results according to the type-level bitmaps, and so
would benefit from a conceptual type-level bitmap that spans multiple
layers.

Implement `struct ewah_or_iterator` which is capable of enumerating
multiple EWAH bitmaps at once, and OR-ing the results together. When
initialized with, for example, all of the commit type bitmaps from each
layer, callers can pretend as if they are enumerating a large type-level
bitmap which contains the commits from *all* bitmap layers.

There are a couple of alternative approaches which were considered:

  - Decompress each EWAH bitmap and OR them together, enumerating a
    single (non-EWAH) bitmap. This would work, but has the disadvantage
    of decompressing a potentially large bitmap, which may not be
    necessary if the caller does not wish to read all of it.

  - Recursively call bitmap internal functions, reusing the "result" and
    "haves" bitmap from the top-most layer. This approach resembles the
    original implementation of this feature, but is inefficient in that
    it both (a) requires significant refactoring to implement, and (b)
    enumerates large sections of later bitmaps which are all zeros (as
    they pertain to objects in earlier layers).

    (b) is not so bad in and of itself, but can cause significant
    slow-downs when combined with expensive loop bodies.

This approach (enumerating an OR'd together version of all of the
type-level bitmaps from each layer) produces a significantly more
straightforward implementation with significantly less refactoring
required in order to make it work.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-03-21 04:34:04 -07:00
..
bitmap.c ewah: `bitmap_equals_ewah()` 2024-05-24 11:40:44 -07:00
ewah_bitmap.c ewah: implement `struct ewah_or_iterator` 2025-03-21 04:34:04 -07:00
ewah_io.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
ewah_rlw.c global: mark code units that generate warnings with `-Wsign-compare` 2024-12-06 20:20:02 +09:00
ewok.h ewah: implement `struct ewah_or_iterator` 2025-03-21 04:34:04 -07:00
ewok_rlw.h ewok_rlw.h: add missing 'inline' to function definition 2018-10-29 10:14:19 +09:00