Skip to content

perf(memory): introduce string interning pool for low-cardinality query results (#604) - #625

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/604-string-interning-pool
Aug 26, 2026
Merged

perf(memory): introduce string interning pool for low-cardinality query results (#604)#625
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/604-string-interning-pool

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

Introduces a high-performance, bounded string interning pool (StringInternPool) during query result decoding in result_row_string_convert.dart to deduplicate repeated cell strings across low-cardinality columns.

Changes

  1. StringInternPool (lib/core/database/result_row_string_convert.dart):
    • Preloaded common database literals (NULL, true, false, 0..10, active, inactive, pending, etc.).
    • Deduplicates repeated cell strings up to a configurable maximum length (default 128 chars) and pool size (default 4096 entries).
  2. Batch & Yielding Decoders:
    • Integrated StringInternPool into convertResultRowsToStringsSync, convertResultRowsToStringsYielding, and convertResultRowsToStringsAdaptive.
  3. Tests & Benchmarks:
    • Unit tests in test/core/database/result_row_string_convert_test.dart verifying pointer identity reuse on duplicate cell values and bounds.
    • Benchmark test validating sub-100ms decoding on 10,000 low-cardinality rows with pointer reuse across columns.

Closes #604

@github-actions github-actions Bot added the performance Theme parser epic label: performance label Aug 26, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit f48512a into dev Aug 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Theme parser epic label: performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant