Twig
Twig copied to clipboard
Added support for foo.some_thing === foo.someThing
Alternative implementation of #934. Works well for methods, properties and array calls of objects with minimal performance impact. Results of twig benchmark (fabpot/twig-perf):
| v1.12.3 | v1.16.3 | origin/master | origin/methods |
------------------------------------------------------------------------------------------------
empty | 13.5 0.0 | 8.8 0.0 | 14.4 0.0 | 20.5 0.0 |
empty/B | 7.9 0.0 | 14.1 0.0 | 14.6 0.0 | 18.9 0.0 |
simple_attribute | 88.2 0.9 | 99.8 0.9 | 99.2 0.8 | 99.3 0.9 |
simple_array_access | 180.2 1.3 | 132.8 0.9 | 120.6 0.9 | 127.1 1.0 |
simple_method_access | 94.4 2.4 | 92.9 2.7 | 101.7 2.7 | 119.7 2.9 |
simple_attribute_big_context/B | 90.5 0.9 | 101.3 0.9 | 100.5 1.0 | 116.1 1.3 |
simple_variable | 710.0 0.7 | 698.6 0.7 | 711.9 0.8 | 680.2 0.7 |
simple_variable_big_context/B | 702.2 1.3 | 668.3 1.3 | 795.9 1.2 | 674.3 1.2 |
simple_foreach | 10.9 0.0 | 21.0 0.0 | 15.2 0.0 | 10.7 0.0 |
simple_foreach/B | 10.1 5.7 | 16.3 7.7 | 9.9 5.0 | 14.5 4.7 |
empty_extends | 9.5 0.0 | 17.4 0.0 | 17.6 0.0 | 13.9 0.0 |
empty_extends/B | 16.1 0.0 | 17.5 0.0 | 10.2 0.0 | 22.6 0.0 |
empty_include | 10.3 0.0 | 10.0 0.0 | 12.1 0.0 | 9.5 0.0 |
empty_include/B | 14.8 0.0 | 14.5 0.0 | 15.4 0.0 | 14.4 0.0 |
standard | 22.1 0.0 | 12.6 0.0 | 12.9 0.0 | 14.0 0.0 |
escaping | 101.8 1.2 | 110.9 1.2 | 107.5 0.8 | 99.2 1.0 |
Wow! This seems like it might be great. I don't know enough of the C code to know how well this is implemented. That is part of the reason I haven't had a chance to follow up on #934 yet. Thanks for running with this!
@fabpot ping
This PR does not hurt performance https://github.com/twigphp/Twig/pull/934#issuecomment-13505353 and works with properties and arrays https://github.com/twigphp/Twig/pull/934#issuecomment-13523606
@tucksaun @jpauli Can you have a look at the C part of this PR?
can we give this PR some life again?
😞
This PR was auto-closed because I've removed the master branch and this PR was based on master. I cannot reopen it unfortunately.
Changing the base branch to 2.x worked :)
This one never moved forward as we did not get feedback on the C implementation. I propose to rebase it on 2.x where we don't have the C extension.
@fabpot The C extension in 1.x is no longer used. Should I update this PR on 1.x or 2.x?
@hason The C extension is gone.