Skip to content

feat: teach ALPRDArray how to append_to_builder#6664

Draft
danking wants to merge 1 commit intodevelopfrom
dk/alprd-decode-into-builder
Draft

feat: teach ALPRDArray how to append_to_builder#6664
danking wants to merge 1 commit intodevelopfrom
dk/alprd-decode-into-builder

Conversation

@danking
Copy link
Contributor

@danking danking commented Feb 24, 2026

The PrimitiveBuilder API is a bit awkward for this. I needed two key things:

  1. I want to treat a trailing slice of the builder's values as a different type. In particular, ALPRD decodes u32s (respectively u64s) and then converts them to f32s (resp. f64s).

  2. I want to separately update the nulls and the values. In particular, ALPRD stores the nulls on the left parts whereas the right parts hold the values.

All of this is copacetic when done on the UninitRange, but I do it on the whole PrimitiveBuilder. I kinda think PrimitiveBuilder should be able to split itself into the initialized and uninitialized parts. In my opinion, it seems reasonable to transmute the builder of uninitialized parts since no one else is looking at that data anyway.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 24, 2026

Merging this PR will improve performance by 96.1%

⚡ 5 improved benchmarks
✅ 949 untouched benchmarks
⏩ 1466 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation alp_rd_decompress_f64 27.4 ms 18.5 ms +48.16%
Simulation decompress_rd[f32, 100000] 1,873.8 µs 955.5 µs +96.1%
Simulation decompress_rd[f32, 10000] 256.6 µs 164.4 µs +56.06%
Simulation decompress_rd[f64, 100000] 2.3 ms 1.4 ms +64.43%
Simulation decompress_rd[f64, 10000] 262.3 µs 171.6 µs +52.88%

Comparing dk/alprd-decode-into-builder (50b4af9) with develop (e0ce169)

Open in CodSpeed

Footnotes

  1. 1466 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@danking danking added feature A feature request changelog/performance A performance improvement and removed feature A feature request labels Feb 28, 2026
The PrimitiveBuilder API is a bit awkward for this. I needed two key things:

1. I want to treat a trailing slice of the builder's values as a different type. In particular,
   ALPRD decodes u32s (respectively u64s) and then converts them to f32s (resp. f64s).

2. I want to separately update the nulls and the values. In particular, ALPRD stores the nulls on
   the left parts whereas the right parts hold the values.

All of this is copacetic *when done on the UninitRange*, but I do it on the whole
PrimitiveBuilder. I kinda think PrimitiveBuilder should be able to split itself into the initialized
and uninitialized parts. In my opinion, it seems reasonable to transmute the builder of
uninitialized parts since no one else is looking at that data anyway.

Signed-off-by: Daniel King <dan@spiraldb.com>
@danking danking force-pushed the dk/alprd-decode-into-builder branch from e14125a to 50b4af9 Compare February 28, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant