Skip to content

Conversation

@dduan
Copy link
Owner

@dduan dduan commented Jan 6, 2026

Reduced redundant array accesses in tableValue, lookupTable, and
lookupArray functions. Each iteration now caches the lookup result
in a local variable instead of accessing the same array element
twice (once for keyHash and once for key).

This reduces array subscript overhead in hot paths during table
and key lookups, particularly beneficial for documents with many
nested tables.

Reduced redundant array accesses in tableValue, lookupTable, and
lookupArray functions. Each iteration now caches the lookup result
in a local variable instead of accessing the same array element
twice (once for keyHash and once for key).

This reduces array subscript overhead in hot paths during table
and key lookups, particularly beneficial for documents with many
nested tables.
@dduan dduan enabled auto-merge (squash) January 6, 2026 17:25
@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Comparing results between 'main' and 'pull_request'

Host 'runnervmh13bl' with 4 'x86_64' processors with 15 GB memory, running:
#18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025

TOMLDecoderBenchmarks

Decode toml.io example metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (μs) * p0 p25 p50 p75 p90 p99 p100 Samples
main 67 68 68 69 73 87 135 7192
pull_request 67 68 68 69 74 88 123 7162
Δ 0 0 0 0 1 1 -12 -30
Improvement % 0 0 0 0 -1 -1 9 -30

Retains: results within specified thresholds, fold down for details.

Retains * p0 p25 p50 p75 p90 p99 p100 Samples
main 625 625 625 625 625 625 625 7192
pull_request 625 625 625 625 625 625 625 7162
Δ 0 0 0 0 0 0 0 -30
Improvement % 0 0 0 0 0 0 0 -30

Parse toml.io example metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (ns) * p0 p25 p50 p75 p90 p99 p100 Samples
main 5981 6111 6155 6203 6275 8239 38462 10000
pull_request 6101 6215 6255 6303 6363 10351 46296 10000
Δ 120 104 100 100 88 2112 7834 0
Improvement % -2 -2 -2 -2 -1 -26 -20 0

Retains: results within specified thresholds, fold down for details.

Retains * p0 p25 p50 p75 p90 p99 p100 Samples
main 9 10 10 10 10 10 10 10000
pull_request 9 10 10 10 10 10 10 10000
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

decode canada.toml metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (ms) * p0 p25 p50 p75 p90 p99 p100 Samples
main 266 266 266 266 267 267 267 4
pull_request 264 264 266 266 266 266 266 4
Δ -2 -2 0 0 -1 -1 -1 0
Improvement % 1 1 0 0 0 0 0 0

Retains: results within specified thresholds, fold down for details.

Retains (K) * p0 p25 p50 p75 p90 p99 p100 Samples
main 1674 1674 1674 1674 1674 1674 1674 4
pull_request 1674 1674 1674 1674 1674 1674 1674 4
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

decode twitter.toml metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (μs) * p0 p25 p50 p75 p90 p99 p100 Samples
main 8937 9003 9036 9060 9118 9331 9511 110
pull_request 8873 8970 8995 9036 9093 9544 10674 110
Δ -64 -33 -41 -24 -25 213 1163 0
Improvement % 1 0 0 0 0 -2 -12 0

Retains: results within specified thresholds, fold down for details.

Retains (K) * p0 p25 p50 p75 p90 p99 p100 Samples
main 66 66 66 66 66 66 66 110
pull_request 66 66 66 66 66 66 66 110
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

parse GitHub events archive metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (ms) * p0 p25 p50 p75 p90 p99 p100 Samples
main 165 167 167 169 179 179 179 6
pull_request 167 168 169 171 178 178 178 6
Δ 2 1 2 2 -1 -1 -1 0
Improvement % -1 -1 -1 -1 1 1 1 0

Retains: results within specified thresholds, fold down for details.

Retains (K) * p0 p25 p50 p75 p90 p99 p100 Samples
main 77 77 77 77 77 77 77 6
pull_request 77 77 77 77 77 77 77 6
Δ 0 0 0 0 0 0 0 0
Improvement % 0 0 0 0 0 0 0 0

parse canada.toml metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (ms) * p0 p25 p50 p75 p90 p99 p100 Samples
main 16 17 18 18 18 19 19 57
pull_request 17 17 18 18 19 20 20 56
Δ 1 0 0 0 1 1 1 -1
Improvement % -6 0 0 0 -6 -5 -5 -1

Retains: results within specified thresholds, fold down for details.

Retains * p0 p25 p50 p75 p90 p99 p100 Samples
main 133 134 134 134 134 134 134 57
pull_request 133 134 134 134 134 134 134 56
Δ 0 0 0 0 0 0 0 -1
Improvement % 0 0 0 0 0 0 0 -1

parse twitter.toml metrics

Time (wall clock): results within specified thresholds, fold down for details.

Time (wall clock) (μs) * p0 p25 p50 p75 p90 p99 p100 Samples
main 2716 2750 2761 2773 2789 2869 3278 355
pull_request 2726 2773 2789 2808 2824 2927 3363 352
Δ 10 23 28 35 35 58 85 -3
Improvement % 0 -1 -1 -1 -1 -2 -3 -3

Retains: results within specified thresholds, fold down for details.

Retains * p0 p25 p50 p75 p90 p99 p100 Samples
main 1293 1294 1294 1294 1294 1294 1294 355
pull_request 1293 1294 1294 1294 1294 1294 1294 352
Δ 0 0 0 0 0 0 0 -3
Improvement % 0 0 0 0 0 0 0 -3

@dduan dduan merged commit 38c385a into main Jan 6, 2026
16 checks passed
@dduan dduan deleted the dd/optimize-lookup-functions-by-caching-array-accesses branch January 6, 2026 17:30
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.

2 participants