Skip to content
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

improve parsing speed #57

Open
ichiriac opened this issue Jan 16, 2017 · 2 comments
Open

improve parsing speed #57

ichiriac opened this issue Jan 16, 2017 · 2 comments

Comments

@ichiriac
Copy link
Member

The lexer speed (reading a string from memory) is about 2,5 millions tokens / sec (depends on CPU).

It's about 3 times more slower than original PHP algorithm, but about 16 times more rapid than a jison based version (which is also more rapid than a regex version ...)

The lexer algorithm could be improved a bit, but there will not be much gain here.

The parser sometimes is 10x slower than the lexer, there is a lot of room to improve the speed, the most cost effective part is recursive parsing on structures like arrays, property chains or string concatenations.

@ichiriac ichiriac self-assigned this Jan 16, 2017
@ichiriac ichiriac modified the milestones: 1.1.0, 1.2.0 Jan 16, 2017
@ichiriac
Copy link
Member Author

ichiriac commented Feb 4, 2017

Disk read speed (only I/O) : 12 Mb / sec

Lexer :

  • Avoid costs with unput calls, instead use of appendToken in order to improve speeds
  • Check if need recusivity/stacks on lexing states and avoid dynamic calls if possible (boolean states)
  • Try to improve the unput function (columns problem)

Actual speed 5 Mb / sec
Target - improve 20% - 6 Mb / sec

Parser :

  • Convert expression recursivity into a loop (avoid huge stacks)
  • Add benchmarks & profiling

Actual speed : 2.5 Mb / sec
Target - improve by 50% - 3.7 Mb / sec


php-reflection is actually at 1.75 Mb / sec, the target is around 2.5 Mb / sec

@ichiriac ichiriac added the LEXER label Feb 4, 2017
@ichiriac ichiriac modified the milestones: 2.1.0, 1.2.0 Mar 6, 2017
@ichiriac
Copy link
Member Author

ichiriac commented Nov 1, 2017

@ichiriac ichiriac modified the milestones: 2.1.0, 2.2.0 Nov 1, 2017
@ichiriac ichiriac modified the milestones: 2.2.0, 3.0.0 Dec 28, 2017
@ichiriac ichiriac modified the milestones: 3.0.0, 3.1.0 Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant