Skip to content

Version 0.31.0

Choose a tag to compare

@veewee veewee released this 27 Mar 09:47
· 7 commits to main since this release
0.31.0
15d1860

Performance Release

This release focuses entirely on encoding/decoding performance. No breaking changes.

What changed

A series of targeted caching improvements were introduced across the encoder pipeline. Each fix eliminates redundant object construction on repeated calls to iso() within a single request.

Merged PRs

PR Change
#52 Cache inner Iso in XsiTypeEncoder to avoid redundant iso() calls
#53 Cache type Iso in ElementEncoder; refactor ElementValueBuilder and ElementValueReader
#55 Cache type Iso in AttributeValueEncoder
#56 Cache FixedIsoEncoder per xsi:type in XsiTypeDetector; introduce ScopedCache; refactor EncoderDetector
#57 Cache ObjectAccess::forContext() by type+namespace+bindingUse (largest single win)

Bumping veewee/reflecta to ^0.17 also contributes a small improvement via a properties_set clone-once optimization (reflecta#26).

Benchmark results

Benchmarks run with phpbench on PHP 8.4, using a complex SOAP type with nested objects. WSDL parsing is excluded from measurements (@BeforeMethods). The baseline is the commit where benchmarks were introduced (before any optimizations).

Encoding

Benchmark Baseline Optimized Improvement
Literal — 1 item 126.2 μs 91.1 μs -28%
Literal — 500 items 62.3 ms 44.7 ms -28%
Encoded — 1 item 174.4 μs 140.0 μs -20%
Encoded — 500 items 86.6 ms 69.1 ms -20%

Decoding

Benchmark Baseline Optimized Improvement
Literal — 1 item 178.7 μs 132.4 μs -26%
Literal — 500 items 90.0 ms 68.5 ms -24%
Encoded — 1 item 250.5 μs 167.6 μs -33%
Encoded — 500 items 129.5 ms 83.0 ms -36%

Comparison with ext-soap

For context, ext-soap (C extension) measured on the same machine:

Operation ext-soap php-soap/encoding Ratio
Encode literal — 1 item 7.6 μs 91.1 μs ~12x slower
Encode encoded — 1 item 12.5 μs 140.0 μs ~11x slower
Decode literal — 1 item 11.3 μs 132.4 μs ~12x slower
Decode encoded — 1 item 16.3 μs 167.6 μs ~10x slower

The gap vs ext-soap is expected: php-soap/encoding operates at the PHP level and provides full type-safety and WSDL-driven encoding as a pure PHP implementation.

Upgrade notes

  • Minimum veewee/reflecta version bumped to ^0.17.
  • No changes to public API. Drop-in upgrade.
  • The new ScopedCache class (Soap\Encoding\Cache\ScopedCache) is @internal.

What's Changed

  • Add phpbench benchmarks with CI regression detection by @veewee in #51
  • Cache inner iso in XsiTypeEncoder by @veewee in #52
  • Cache type iso in ElementEncoder, refactor value builder/reader by @veewee in #53
  • Cache type iso in AttributeValueEncoder by @veewee in #55
  • Cache xsi:type encoder detection in XsiTypeDetector by @veewee in #56
  • Cache ObjectAccess::forContext() using ScopedCache by @veewee in #57

Full Changelog: 0.30.0...0.31.0