rfc:tsrmls-fetch-reduction
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:tsrmls-fetch-reduction [2010/09/09 23:13] – Update felipe | rfc:tsrmls-fetch-reduction [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2010-09-09 | * Date: 2010-09-09 | ||
- | * Author: Felipe Pena < | + | * Author: Felipe Pena <felipe@php.net>, |
- | * Status: Under Discussion | + | * Status: Under implementation |
===== Introduction ===== | ===== Introduction ===== | ||
- | The purpose of RFC is to show a way to reduce several function call by avoiding useless TSRMLS_FETCH() usage. | + | The purpose of RFC is to show a way to reduce several function call by avoiding useless TSRMLS_FETCH() usage on ZTS. Adding TSRMLS_CC to the memory allocation macros/ |
===== Changes ====== | ===== Changes ====== | ||
- | |||
- | The main goal was to create a new version of each memory allocation function/ | ||
See below some macros/ | See below some macros/ | ||
^ Current function/ | ^ Current function/ | ||
- | | emalloc | + | | emalloc |
- | | ecalloc | + | | ecalloc |
- | | pemalloc | + | | pemalloc |
- | | erealloc | + | | erealloc |
- | | efree | efreets | + | | efree | efree2 |
- | | estrdup | + | | estrdup |
- | | estrndup | + | | estrndup |
+ | ===== Profiler ===== | ||
+ | |||
+ | Using cachegrind (//valgrind --tool=cachegrind --cachegrind-out-file=profile sapi/ | ||
+ | |||
+ | ^ Function ^ Ir (Patched) ^ Ir (Current) ^ | ||
+ | | pthread_getspecific | 498,129,021 | 1, | ||
+ | | ts_resource_ex | 394,353,075 | 1, | ||
+ | | efree | 459,940,754 | 840,217,602 | | ||
+ | |||
+ | ^ Ir Total (Patched) ^ Ir Total (Current) ^ | ||
+ | | 42, | ||
+ | |||
+ | // Ir - Instruction read // | ||
===== Benchmark ===== | ===== Benchmark ===== | ||
+ | |||
+ | ==== Zend/ | ||
^ Zend/ | ^ Zend/ | ||
Line 48: | Line 61: | ||
| Total | 23.547 | 27.328 | | | Total | 23.547 | 27.328 | | ||
+ | ==== Zend/ | ||
+ | |||
+ | **Patched** | ||
+ | < | ||
+ | empty_loop | ||
+ | func() | ||
+ | undef_func() | ||
+ | int_func() | ||
+ | $x = self:: | ||
+ | self::$x = 0 | ||
+ | isset(self:: | ||
+ | empty(self:: | ||
+ | $x = Foo:: | ||
+ | Foo::$x = 0 1.746 0.936 | ||
+ | isset(Foo:: | ||
+ | empty(Foo:: | ||
+ | self:: | ||
+ | Foo:: | ||
+ | $x = $this-> | ||
+ | $this->x = 0 | ||
+ | $this->x += 2 1.863 1.053 | ||
+ | ++$this-> | ||
+ | --$this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | isset($this-> | ||
+ | empty($this-> | ||
+ | $this-> | ||
+ | $x = Foo:: | ||
+ | new Foo() | ||
+ | $x = TEST 1.327 0.517 | ||
+ | $x = $_GET | ||
+ | $x = $GLOBALS[' | ||
+ | $x = $hash[' | ||
+ | $x = $str[0] | ||
+ | ------------------------ | ||
+ | Total | ||
+ | </ | ||
+ | **Current (trunk)** | ||
+ | < | ||
+ | empty_loop | ||
+ | func() | ||
+ | undef_func() | ||
+ | int_func() | ||
+ | $x = self:: | ||
+ | self::$x = 0 | ||
+ | isset(self:: | ||
+ | empty(self:: | ||
+ | $x = Foo:: | ||
+ | Foo::$x = 0 1.769 0.971 | ||
+ | isset(Foo:: | ||
+ | empty(Foo:: | ||
+ | self:: | ||
+ | Foo:: | ||
+ | $x = $this-> | ||
+ | $this->x = 0 | ||
+ | $this->x += 2 2.006 1.208 | ||
+ | ++$this-> | ||
+ | --$this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | isset($this-> | ||
+ | empty($this-> | ||
+ | $this-> | ||
+ | $x = Foo:: | ||
+ | new Foo() | ||
+ | $x = TEST 1.558 0.760 | ||
+ | $x = $_GET | ||
+ | $x = $GLOBALS[' | ||
+ | $x = $hash[' | ||
+ | $x = $str[0] | ||
+ | ------------------------ | ||
+ | Total | ||
+ | </ | ||
- | ===== Proposal and Patch ===== | + | ===== Patch ===== |
- | Comming soon | + | http:// |
===== Changelog ===== | ===== Changelog ===== |
rfc/tsrmls-fetch-reduction.1284074029.txt.gz · Last modified: 2017/09/22 13:28 (external edit)