Skip to content

Performance improvements

Pre-release
Pre-release
Compare
Choose a tag to compare
@turanct turanct released this 10 Apr 13:11
· 15 commits to main since this release
  • PERFORMANCE: use static keyword on all closures
  • PSALM: update some annotations to work with newer psalm versions
  • PERFORMANCE: simplify appendSuccess in the Succeed class
  • PERFORMANCE: reduce indirection with the guardEndOfStream() in StringStream

These resulted in a small speedup of the JSON Parser example.

Before changes:

+-----------+----------------------+-----+------+-----+------------+-------------+---------+
| benchmark | subject              | set | revs | its | mem_peak   | mode        | rstdev  |
+-----------+----------------------+-----+------+-----+------------+-------------+---------+
| JSONBench | bench_json_encode    | 0   | 5    | 3   | 1,710,104b | 7.617μs     | ±46.68% |
| JSONBench | bench_Parsica_JSON   | 0   | 5    | 3   | 2,168,552b | 6,539.741μs | ±5.28%  |
| JSONBench | bench_basemax_jpophp | 0   | 5    | 3   | 1,878,760b | 633.373μs   | ±24.11% |
+-----------+----------------------+-----+------+-----+------------+-------------+---------+

After changes:

+-----------+----------------------+-----+------+-----+------------+-------------+----------+
| benchmark | subject              | set | revs | its | mem_peak   | mode        | rstdev   |
+-----------+----------------------+-----+------+-----+------------+-------------+----------+
| JSONBench | bench_json_encode    | 0   | 5    | 3   | 1,710,200b | 5.978μs     | ±29.48%  |
| JSONBench | bench_Parsica_JSON   | 0   | 5    | 3   | 2,160,184b | 6,256.940μs | ±8.37%   |
| JSONBench | bench_basemax_jpophp | 0   | 5    | 3   | 1,878,856b | 633.060μs   | ±3.00%   |
+-----------+----------------------+-----+------+-----+------------+-------------+----------+