Skip to content

perf: cache type keys in DataConverter to avoid repeated array_keys calls - #10753

Open
gr8man wants to merge 1 commit into
codeigniter4:developfrom
gr8man:perf/dataconverter-cache-type-keys
Open

gr8man wants to merge 1 commit into
codeigniter4:developfrom
gr8man:perf/dataconverter-cache-type-keys

Conversation

@gr8man

@gr8man gr8man commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Description
In DataConverter::fromDataSource() and toDataSource(), array_keys($this->types) was repeatedly called for every single converted row or record, resulting in unnecessary array allocations in memory. This PR caches the type keys once in $this->typeFields in the constructor, reducing CPU and memory overhead during row hydration and conversion.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@carson-codeigniter4 carson-codeigniter4 Bot added the enhancement PRs that improve existing functionalities label Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement PRs that improve existing functionalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant