json-parser icon indicating copy to clipboard operation
json-parser copied to clipboard

Performance?

Open daniel-sc opened this issue 1 year ago • 6 comments

Detailed description

After using this library to iterate larger JSON responses from Guzzle (using the pointer /- on \Psr\Http\Message\StreamInterface), I noticed a significant reduction in memory usage (great!), but as well a significant increase in CPU load. Is this expected? What are possible mitigation strategies? Would different options (chunk size, lazy pointers, ..) help?

Context

Of course generally the "space-time tradeoff" implies some increase in CPU, but I expected this to be not significant..

Possible implementation

Possibly a section on this in the readme would help, maybe even a comparison to the alternatives to see if this is on the same level?

Your environment

  • Version used: PHP 8.1
  • Operating system and version: Ubuntu 22.0

daniel-sc avatar Feb 14 '24 20:02 daniel-sc