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

10% of CPU time is spent on node allocation #113

Closed
mk6i opened this issue Jun 4, 2021 · 2 comments
Closed

10% of CPU time is spent on node allocation #113

mk6i opened this issue Jun 4, 2021 · 2 comments
Assignees

Comments

@mk6i
Copy link
Collaborator

mk6i commented Jun 4, 2021

I created a small benchmark that iterates tests/001.phpt 10000 times without printing and ran it through perf. The results indicate that 10% of CPU time is spent allocating AST nodes.

Screen Shot 2021-06-04 at 9 35 24 AM

emalloc() is called for each new node. We can probably reduce this bottleneck by either allocating nodes in chunks or simply using a stack-allocated array. This might make it possible to bring performance closer to the native PHP test for small/medium data sets.

@mk6i mk6i self-assigned this Jun 4, 2021
@crocodele
Copy link
Collaborator

Nice find!

@mk6i
Copy link
Collaborator Author

mk6i commented Jun 28, 2021

Addressed this issue in #115.

@mk6i mk6i closed this as completed Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants