Skip to content

Cache inner iso in XsiTypeEncoder#52

Merged
veewee merged 4 commits intophp-soap:mainfrom
veewee:feature/xsi-type-encoder-iso-cache
Mar 26, 2026
Merged

Cache inner iso in XsiTypeEncoder#52
veewee merged 4 commits intophp-soap:mainfrom
veewee:feature/xsi-type-encoder-iso-cache

Conversation

@veewee
Copy link
Copy Markdown
Member

@veewee veewee commented Mar 26, 2026

Summary

  • Captures $this->encoder->iso($context) once in iso() instead of calling it on every encode/decode invocation
  • Keeps the existing private to() and from() methods for readability, just passes the cached iso as a parameter
  • In from(), reuses the cached iso when xsi:type detection resolves to the same encoder

Impact

Negligible in isolation (~1%), but establishes the pattern that iso() should capture its dependencies eagerly. This becomes more meaningful when combined with downstream caches (ObjectAccess, XsiTypeDetector).

Test plan

  • Full test suite passes (549 tests)

veewee added 4 commits March 26, 2026 09:13
Captures $this->encoder->iso($context) once in iso() and passes
the result to the private to() and from() methods. This avoids
rebuilding the inner iso on every encode/decode invocation.

In from(), when xsi:type detection resolves to the same encoder,
the cached iso is reused instead of calling iso() again.
Encoders accept string|Element in from() by design, but the Iso
generic is typed as Iso<mixed, string>.
@veewee veewee merged commit 8fc46d5 into php-soap:main Mar 26, 2026
15 of 16 checks passed
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.

1 participant