Skip to content

Optimize Compressor::rebuild_from by removing full pass on the two-bytes codes#222

Merged
AdamGS merged 1 commit into
developfrom
adamg/optimize-rebuild-from
Jun 2, 2026
Merged

Optimize Compressor::rebuild_from by removing full pass on the two-bytes codes#222
AdamGS merged 1 commit into
developfrom
adamg/optimize-rebuild-from

Conversation

@AdamGS

@AdamGS AdamGS commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Instead of having an UNSUSED state, we start by populating the two-byte codes vec with the initial state from the 1-byte codes array, then just override it where applicable.

Impact

For the new benchmarks I get:

rebuild-from/empty-table
                        time:   [9.2503 µs 9.4427 µs 9.6325 µs]
                        change: [-68.678% -67.274% -66.086%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild
rebuild-from/one-byte-table
                        time:   [9.1684 µs 9.2991 µs 9.4306 µs]
                        change: [-68.056% -66.830% -65.802%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  1 (1.00%) low severe
  4 (4.00%) low mild
rebuild-from/two-byte-table
                        time:   [9.0790 µs 9.2371 µs 9.4144 µs]
                        change: [-68.339% -67.150% -65.978%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) low mild
rebuild-from/mixed-length-table
                        time:   [9.3243 µs 9.4667 µs 9.6103 µs]
                        change: [-67.862% -66.675% -65.387%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild
rebuild-from/trained-table
                        time:   [9.2450 µs 9.3939 µs 9.5343 µs]
                        change: [-67.732% -66.724% -65.681%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low mild

Signed-off-by: Adam Gutglick <adam@spiraldb.com>
@codspeed-hq

codspeed-hq Bot commented Jun 2, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 13.03%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
✅ 22 untouched benchmarks
🆕 5 new benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation decompress-into-reuse 687.8 ns 600.3 ns +14.58%
Simulation compress-twobytes 238.6 ns 209.4 ns +13.93%
Simulation compress-hashtab 303.6 ns 274.4 ns +10.63%
🆕 Simulation mixed-length-table N/A 91.1 µs N/A
🆕 Simulation trained-table N/A 91.8 µs N/A
🆕 Simulation empty-table N/A 90.6 µs N/A
🆕 Simulation one-byte-table N/A 90.6 µs N/A
🆕 Simulation two-byte-table N/A 90.7 µs N/A

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing adamg/optimize-rebuild-from (579bf95) with develop (fbe1ce2)

Open in CodSpeed

@AdamGS AdamGS changed the title Optimize Compressor::rebuild_from Optimize Compressor::rebuild_from by removing full pass on the two-bytes codes Jun 2, 2026
@AdamGS AdamGS requested review from a10y and joseph-isaacs June 2, 2026 14:44
@AdamGS AdamGS marked this pull request as ready for review June 2, 2026 14:53
@AdamGS AdamGS merged commit 7acdbad into develop Jun 2, 2026
6 checks passed
@AdamGS AdamGS deleted the adamg/optimize-rebuild-from branch June 2, 2026 15:34
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.

3 participants