Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hashing is not necessary to generate unique variable names during compilation - #3601

Merged
fabpot merged 1 commit into
twigphp:2.xfrom
GromNaN:less-hash
Dec 14, 2021
Merged

Hashing is not necessary to generate unique variable names during compilation#3601
fabpot merged 1 commit into
twigphp:2.xfrom
GromNaN:less-hash

Conversation

@GromNaN

@GromNaN GromNaN commented Dec 13, 2021

Copy link
Copy Markdown
Contributor

Trying to optimize calls to hash function (#3588), I found that some calls are made during compilation that are not necessary at all.

According to the last commits on this functions (57ff882 & 6ab5fe9), the internal variable names must be unique and deterministic. Using a simple sequence is enough.

This avoid CPU cycles during compilation. Which should not have any impact on production; but still interesting for dev&test.

Comment thread src/Profiler/NodeVisitor/ProfilerNodeVisitor.php Outdated
Comment thread src/Profiler/NodeVisitor/ProfilerNodeVisitor.php Outdated
@fabpot

fabpot commented Dec 14, 2021

Copy link
Copy Markdown
Contributor

Thank you @GromNaN.

@fabpot
fabpot merged commit 2117e4b into twigphp:2.x Dec 14, 2021
@GromNaN
GromNaN deleted the less-hash branch February 2, 2022 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants