Skip to content

Conversation

@gbaraldi
Copy link
Member

@gbaraldi gbaraldi commented Jan 28, 2026

Remove @isdefined checks from scan_specified_partitions by restructuring
the loop to always initialize variables on the first iteration. This
avoids the overhead of throw_undef_if_not checks in the generated code.

Co-Authored-By: Claude Opus 4.5 [email protected]

The @isdefined thing while cute, turns out LLVM made a mess of it and made the control flow of the function a lot more complex than it needs to be, so just manually unroll the function
Saves like 10ns per call to this (yeah the improvements are quite small)

Remove @isdefined checks from scan_specified_partitions by restructuring
the loop to always initialize variables on the first iteration. This
avoids the overhead of throw_undef_if_not checks in the generated code.

Also add @inline annotations to walk_binding_partition, query calls,
and WorldRange union/intersect functions to enable better optimization.

The function now:
- Processes the first partition outside the loop to initialize variables
- Uses local variables for frequently accessed values (wwr_min, wwr_this)
- Tracks total_min separately to avoid repeated min_world() calls

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@gbaraldi gbaraldi requested a review from Keno January 28, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant