Benchmarks - mattacosta/php-parser GitHub Wiki
Benchmark (November 2018)
Drupal
- Version: 8.6.x @ 5d17da1
- Files: 8401
parser |
time (ms) |
memory (kb) |
bmewburn/php7parser |
5789.22 |
1189471.94 |
microsoft/tolerant-php-parser |
16455.64 |
1174311.48 |
nikic/php-parser |
25693.36 |
1784685.80 |
mattacosta/php-parser (base) |
8122.56 |
268384.77 |
mattacosta/php-parser (syntax) |
-- |
471899.52 |
Magento2
- Version: 2.3-develop @ b252ca0
- Files: 21688
parser |
time (ms) |
memory (kb) |
bmewburn/php7parser |
12972.62 |
2440786.40 |
microsoft/tolerant-php-parser |
32648.24 |
2384537.00 |
nikic/php-parser |
43200.28 |
3423339.44 |
mattacosta/php-parser (base) |
19071.94 |
498955.02 |
mattacosta/php-parser (syntax) |
-- |
882281.16 |
Methodology
Parse time is determined by reading a PHP file from disk, starting a timer,
parsing the file (and saving it to a list), and finally stopping the timer.
Memory usage is determined before and after all files are parsed. For JS
implementations, garbage collection is also performed before each measurement.
Notes
Memory requirements
- By default, Node.js applications are limited to 1.5 GB of memory. While the
application may not immediately encounter an exception, it will experience
a significant slow-down as the garbage collector attempts to reclaim unused
memory. The
--max-old-space-size
flag is used to bypass this restriction.
- All PHP applications immediately terminate once reaching the maximum amount
memory a script may consume. This value is determined by the
memory_limit
ini
setting.
mattacosta/php-parser
Parsing a file results in an internal base representation of the syntax tree.
This tree is not directly accessible. Instead, syntax nodes are created
on-demand and saved for future use. The syntax representation used here is
generated by visiting all nodes and tokens, but not trivia (which is unnecessary
in most project-wide scenarios).
Packages
parser |
version |
bmewburn/php7parser |
1.0.8 |
mattacosta/php-parser |
1.0.0-beta.4 |
microsoft/tolerant-php-parser |
0.0.15 |
nikic/php-parser |
4.1.0 |
Runtime environments
runtime |
version |
Node |
8.11.4 |
PHP |
7.3.0RC1 |