rfc:fast_zpp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:fast_zpp [2014/05/23 12:27] – - typo in macro name bwoebi | rfc:fast_zpp [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2014-05-23 | * Date: 2014-05-23 | ||
* Author: Dmitry Stogov < | * Author: Dmitry Stogov < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 16: | Line 16: | ||
===== Proposal ===== | ===== Proposal ===== | ||
We propose an additional fast API for parameter parsing, that should be used for the most useful functions. The API is based on C macros that lead to inlining of optimized code directly into the body of internal function. | We propose an additional fast API for parameter parsing, that should be used for the most useful functions. The API is based on C macros that lead to inlining of optimized code directly into the body of internal function. | ||
+ | |||
+ | **We don't propose to remove the existing API, and would suggest to use fast API only for most often used functions to get performance boost.** | ||
I'll explain API on the following example: | I'll explain API on the following example: | ||
Line 36: | Line 38: | ||
The first code fragment is just taken from PHP_FUNCTION(array_slice), | The first code fragment is just taken from PHP_FUNCTION(array_slice), | ||
- | ZEND_PARSE_PARAMETERS_START() takes two arguments minimal and maximal parameters count. (In general, it's possible to avoid these arguments, but not for free. I'll explain it separate " | + | ZEND_PARSE_PARAMETERS_START() takes two arguments minimal and maximal parameters count. |
Z_PARAM_ARRAY() - takes the next argument as array, Z_PARAM_LONG - as long, Z_PARAM_OPTIONAL - tells that the remaining arguments are optional. | Z_PARAM_ARRAY() - takes the next argument as array, Z_PARAM_LONG - as long, Z_PARAM_OPTIONAL - tells that the remaining arguments are optional. | ||
Line 42: | Line 44: | ||
The new API covers all possibilities of the existing API. The following table shows the correspondence between old specifiers and new macros. | The new API covers all possibilities of the existing API. The following table shows the correspondence between old specifiers and new macros. | ||
- | ^ specifier ^ Fast ZPP API macro ^^ | + | ^ specifier ^ Fast ZPP API macro ^ args ^ |
| '' | | '' | ||
| a | Z_PARAM_ARRAY(dest) | | a | Z_PARAM_ARRAY(dest) | ||
Line 67: | Line 69: | ||
- | The effect of **!** and **/** modifiers may be achieved using extended version of the same macros e.g. Z_PARAM_ZVAL_EX(dest, | + | The effect of **!** and reference |
- | + | ||
- | ==== Simpler Variation ==== | + | |
- | + | ||
- | It's possible not to specify minimal and maximal arguments in ZEND_PARSE_PARAMETERS_START() macro, but it leads to some small performance degradation and possible inconsistent error messages when few constraint are broken at same time. For example the following code '' | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | however the original PHP would emit | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | This is not a common case. Actually, it breaks just 2 PHPT tests. | + | |
- | So the penalties may be accepted in cost of usability. | + | |
- | On the other hand these number need to be written just once... | + | |
==== Performance Evaluation ==== | ==== Performance Evaluation ==== | ||
Line 90: | Line 78: | ||
| phpng | 5, | | phpng | 5, | ||
| phpng + fast_zpp | | phpng + fast_zpp | ||
- | | phpng + simple variation | 4, | ||
Line 101: | Line 88: | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
- | This proposal is targeted to phpng | + | This proposal is targeted to php-7 |
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | * no | + | State whether this project requires 50%+1 majority (see [[voting]]). The vote is a straight Yes/No vote. |
- | * yes | + | |
- | * yes for simpler variation | + | |
- | State whether this project requires 50%+1 majority (see [[voting]]) | + | <doodle title=" |
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | The vote concluded on January 27th. | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
* Original Proposal: https:// | * Original Proposal: https:// | ||
- | * Simpler Variation: https://gist.github.com/ | + | |
+ | The patch is already included into PHP-7 and wrapped with ifdef/ifndef FAST_ZPP. | ||
rfc/fast_zpp.1400848027.txt.gz · Last modified: 2017/09/22 13:28 (external edit)