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

array_filter with strlen overhead #311

Closed
ghost opened this issue Nov 1, 2016 · 1 comment
Closed

array_filter with strlen overhead #311

ghost opened this issue Nov 1, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 1, 2016

After profiling our code I noticed that smarty spends quite some time in array_filter and strlen. Since the objective seems to be to eliminate empty entries from the array the second parameter is not necessary. If no second parameter is given all entries evaluating to false are eliminated - which has the same net effect - at a much lower performance cost.

I could not find any differences in the output. Could we remove the unnecessary strlen here?

uwetews added a commit to smarty-php/smarty-lexer that referenced this issue Nov 6, 2016
uwetews added a commit to smarty-php/smarty-lexer that referenced this issue Nov 7, 2016
uwetews added a commit that referenced this issue Nov 7, 2016
@uwetews
Copy link
Contributor

uwetews commented Nov 7, 2016

Thanks for bringing this up.
The master branch is now updated with the optimized lexer.
Besides array_filter() some additional optimizations have been made.

@uwetews uwetews closed this as completed Nov 7, 2016
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

1 participant