Skip to content

Binary searches over member and node refs visit ids in no particular order #230

Backlog

Description

@cldellow

Several lookups test the node refs of a way, or the members of a relation, against a sorted vector:

  • binary_search_for_id (core/datatypes.h): way geometry (make_geometry) and relation geometry (relation_geometry_store.cc).
  • binary_search_for_pair_id (core/datatypes.h): relation members in the bbox filter, the around filter and member collection.
  • has_a_child_with_id and has_a_child_with_id_and_role (data/abstract_processing.h): way(bn), rel(bn), rel(bw), rel(br) and their role forms.

The refs come in path or member order, so the ids looked up jump around, and about half of a branchy binary search's branches mispredict. A branchless (monobound) search avoids that.

This is the opposite of the call sites in #227 and #229, where lookups mostly ascend (#228). On x86, #227's monobound search was faster even there; on ARM it was slower. This issue tracks measuring the monobound search where it should help most: at the unpredictable lookups only.

Activity

  1. added
    query-perf
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    query-perf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions