-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port TypeParser to Hoa\Compiler #900
Conversation
2ae4468
to
5f01c04
Compare
5f01c04
to
494002a
Compare
Rebased onto current master (2.0), dropping old TypeParser completely. It serves as a drop-in replacement of old TypeParser now. |
494002a
to
598ddb0
Compare
Just to understand better hoa compiler, has this code present in this PR to be "maintained" of is automatically generated by HOA? (currently to me it seems a lot of "mysterious" code landing in the main repo...) |
What about the phpunit warning/failure? |
598ddb0
to
2cee96c
Compare
Updated.
Regarding parsing itself, the burden is to maintain grammar.pp and TypeVisitor. InnerParser is generated code by Hoa state exporter.
The one there is caused by lowest deps of Hoa Compiler itself, likely dependency issue on their side. :/ |
Reported here: hoaproject/Compiler#83 |
81c8cc6
to
8508128
Compare
Right, for now I added conflicts with incompatible lowest deps, that should be good enough. |
8508128
to
c52376f
Compare
can you rebase this please? |
c52376f
to
a86975f
Compare
done |
Did some benchmarking... $typeParser = new \JMS\Serializer\Type\Parser();// HOA
$typeParser = new \JMS\Serializer\TypeParser(); // current parser
///
$typeParser->parse('array<string, User>');
$t = microtime(true);
for ($i = 0; $i < 100000; $i++) {
$typeParser->parse('array<string, User>');
}
var_dump(microtime(true)-$t); Results:
Not that fast 😞 |
a) you are not going to parse a type 100000x, not even 10000x, 1000x, maybe 100x |
"doctrine/annotations": "^1.0", | ||
"doctrine/instantiator": "^1.0.3" | ||
"doctrine/instantiator": "^1.0.3", | ||
"hoa/compiler": "^3.17.08.08" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, which versioning scheme does HOA follows? Is this some kind of 3.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, it's <major>.<releaseyear>.<releasemonth>.<releaseday>
. Looks pretty weird, but incidentally works with semver. 😂
Even if performance wise there is a drop of 2% on a single iteration, there are advantages with using a AST based parser. Plus having |
This is a port of TypeParser to Hoa\Compiler. It is entirely independent on legacy and abandoned jms/parser-lib.no
It's currently built on top of current TypeParser to achive & present the prototype and compatibility - this way it can be tested and used even on 1.x. (I won't be rebasing this on top of 2.0 PR.)Includes/TODO:
legacy visitor used as a compatibility hack for 1.xAST visitor to build AST tree of the type definitionAST-based manipulation in consumersWould love to hear some opinions / feedback. 😎
PHP <7.1 tests will be failing because of the PHP 5.x/7.0 madness.