Optimize memory consumption
just profiled a codebase via phpstan and blackfire tells me that the classes using most memory are from PHP-Parser.
I am pretty sure you already optimized the hell out of this classes/package, so I just leave this here in case you missed an oportunity. feel free to close if things are already optimal.
a blackfire profile can be found in https://blackfire.io/profiles/6422c219-e7d5-43b1-8f85-ab4fb9b8faa5/graph (I guess the link will not work forever)
I guess the most relevant part (memory wise) is:

php vendor/bin/phpstan --version
PHPStan - PHP Static Analysis Tool 0.12.7
php --version
PHP 7.2.27-6+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 5 2020 16:52:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.27-6+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with blackfire v1.30.0~linux-x64-non_zts72, https://blackfire.io, by Blackfire
token_get_all() is a PHP tokenizer extension function as far as I can tell, so that is hard to optimize without some magical stuff I'd say.
right, token_get_all() is something which would need to be im proved on the php-src level (if possible).
still 2nd and 3rd most memory is consumed by methods/classes of this lib
You motivated me to resurrect this: https://github.com/php/php-src/pull/5176 Gonna write an RFC...
Cool, everything perfect then :-)
PHP-Parser 5.0 will be using the new object-based token representation, so I'm going to close this one.