rfc:tsrmls-fetch-reduction
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:tsrmls-fetch-reduction [2010/09/09 22:59] – created 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 where TSRMLS_FETCH() is not used, thus using these new functions | + | See below some macros/functions |
- | ===== Proposal and Patch ===== | + | ^ Current function/ |
+ | | emalloc | ||
+ | | ecalloc | ||
+ | | pemalloc | ||
+ | | erealloc | ||
+ | | efree | efree2 | ||
+ | | estrdup | ||
+ | | estrndup | ||
- | Comming soon | + | ===== 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 ===== | ||
+ | |||
+ | ==== Zend/ | ||
+ | |||
+ | ^ Zend/ | ||
+ | | simple | ||
+ | | simplecall | ||
+ | | simpleucall | ||
+ | | simpleudcall | ||
+ | | mandel | ||
+ | | mandel2 | ||
+ | | ackermann(7) | ||
+ | | ary(50000) | ||
+ | | ary2(50000) | ||
+ | | ary3(2000) | ||
+ | | fibo(30) | ||
+ | | hash1(50000) | ||
+ | | hash2(500) | ||
+ | | heapsort(20000) | ||
+ | | matrix(20) | ||
+ | | nestedloop(12) | ||
+ | | sieve(30) | ||
+ | | strcat(200000) | ||
+ | | 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 | ||
+ | </ | ||
+ | |||
+ | ===== Patch ===== | ||
+ | |||
+ | http:// | ||
===== Changelog ===== | ===== Changelog ===== |
rfc/tsrmls-fetch-reduction.1284073196.txt.gz · Last modified: 2017/09/22 13:28 (external edit)