fxmlrpc/serialization

Serialization logic for FXMLRPC

0.2.0 2018-02-11 12:18 UTC

This package is auto-updated.

Last update: 2024-12-19 09:38:32 UTC


README

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

Serialization logic for FXMLRPC.

Install

Via Composer

$ composer require fxmlrpc/serialization

Usage

This is the contract package for serialization logic used in FXMLRPC.

Currently the following implementations are available:

  • Native: Uses XML-RPC extension
  • XML Reader: Custom XML reading logic utilizing bitmasks
  • Zend Framework Adapter

How fast is it really?

IO performance is out of reach from a userspace perspective, but parsing and serialization speed is what matters. How fast can we generate the XML payload from PHP data structures and how fast can we parse the servers response? FXMLRPC uses stream based XML writers/readers to achieve it’s performance and heavily optimizes (read uglifies) for it. As a result the userland version is only around 2x slower than the native C implementation (ext/xmlrpc).

8 subjects, 80 iterations, 320 revs, 0 rejects
min mean max: 11,497.750 118,279.634 339,007.500 (μs/r)
⅀T: 37,849,483.000μs μSD/r 5,275.433μs μRSD/r: 6.047%

+-----------------+-----------------------+-------+------+-----+-------------+----------------+----------------+----------------+---------------+--------+
| benchmark       | subject               | group | revs | its | mem         | min            | mean           | max            | stdev         | rstdev |
+-----------------+-----------------------+-------+------+-----+-------------+----------------+----------------+----------------+---------------+--------+
| ParserBench     | benchNativeParser     |       | 40   | 10  | 15,644,120b | 118,311.2500μs | 123,752.2250μs | 127,034.7500μs | 2,196.4803μs  | 1.77%  |
| ParserBench     | benchSaxParser        |       | 40   | 10  | 15,594,984b | 144,438.0000μs | 149,607.9000μs | 157,309.2500μs | 3,892.3376μs  | 2.60%  |
| ParserBench     | benchZendParser       |       | 40   | 10  | 56,321,216b | 278,974.5000μs | 287,957.9750μs | 317,007.5000μs | 10,655.0098μs | 3.70%  |
| SerializerBench | benchNativeSerializer |       | 40   | 10  | 12,420,416b | 11,497.7500μs  | 12,464.6500μs  | 15,255.5000μs  | 1,416.8554μs  | 11.37% |
| SerializerBench | benchSaxSerializer    |       | 40   | 10  | 15,460,152b | 22,643.2500μs  | 24,231.8250μs  | 26,539.7500μs  | 1,411.6560μs  | 5.83%  |
| SerializerBench | benchZendSerializer   |       | 40   | 10  | 15,671,376b | 21,832.5000μs  | 24,071.2500μs  | 28,176.2500μs  | 1,948.6380μs  | 8.10%  |
+-----------------+-----------------------+-------+------+-----+-------------+----------------+----------------+----------------+---------------+--------+

Run ./vendor/bin/phpbench run --report=custom to execute the benchmarking test suite.

Zend Incompatibility list

Zend is not fully compatible with the rest of the serializers and parsers.

Parser incompatibility

  • Automatically decodes Base64 encoded values
  • Does not return DateTime objects
  • Cannot return empty DateTime values
  • Does not support Apache Nil
  • Incorrectly detects invalid multiple parameters
  • Cannot parse response containing an XXE Attack

Serializer incompatibility

  • If no params are passed, no empty params tag is generated
  • Unlike the xmlrpc extension, Zend does not add newlines

Testing

$ composer test

Security

If you discover any security related issues, please contact us at security@fxmlrpc.org.

Credits

License

The MIT License (MIT). Please see License File for more information.