rfc:tsrmls-fetch-reduction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:tsrmls-fetch-reduction [2010/09/09 23:52] – update feliperfc:tsrmls-fetch-reduction [2010/09/22 13:51] – update felipe
Line 2: Line 2:
   * Version: 1.0   * Version: 1.0
   * Date: 2010-09-09   * Date: 2010-09-09
-  * Author: Felipe Pena <felipe@php.net> +  * Author: Felipe Pena <felipe@php.net>, Pierre Alain Joye <pajoye@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 on ZTS.+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/function, hash api, zend_llist and streams.
  
 ===== Changes ====== ===== Changes ======
- 
-The main goal was to create a new version of each memory allocation function/macro where TSRMLS_FETCH() is not used, thus using these new functions/macros only when suitable avoiding to call the function that does thread id fetch. 
  
 See below some macros/functions will be added by the patch. See below some macros/functions will be added by the patch.
  
 ^ Current function/macro ^ New function/macro ^ ^ Current function/macro ^ New function/macro ^
-| emalloc          | emallocts    | +| emalloc          | emalloc2    | 
-| ecalloc          | ecallocts    | +| ecalloc          | ecalloc2    | 
-| pemalloc         pemallocts   | +| pemalloc         pemalloc2   | 
-| erealloc         ereallocts   | +| erealloc         erealloc2   | 
-| efree            | efreets      | +| efree            | efree2      | 
-| estrdup          | estrdupts    | +| estrdup          | estrdup2    | 
-| estrndup         estrndupts   | +| estrndup         estrndup2   | 
-ALLOC_INIT_ZVAL  ALLOC_INIT_ZVAL_TS + 
-SEPARATE_ZVAL    SEPARATE_ZVAL_TS   +===== Profiler ===== 
-SEPARATE_ZVAL_IF_NOT_REF SEPARATE_ZVAL_IF_NOT_REF_TS + 
-SEPARATE_ZVAL_TO_MAKE_IS_REF SEPARATE_ZVAL_TO_MAKE_IS_REF_TS |+Using cachegrind (//valgrind --tool=cachegrind --cachegrind-out-file=profile sapi/cli/php Zend/bench.php//) to see the improvement, we can see the follow differences: 
 + 
 +^ Function ^ Ir (Patched) ^ Ir (Current) ^ 
 +pthread_getspecific 498,129,021 | 1,269,764,085 
 +ts_resource_ex 394,353,075 | 1,005,230,834 
 +efree 459,940,754 840,217,602 | 
 + 
 +^ Ir Total (Patched) ^ Ir Total (Current) ^ 
 +42,537,064,394 44,080,331,320 | 
 + 
 +// Ir - Instruction read //
  
 ===== Benchmark ===== ===== Benchmark =====
Line 92: Line 100:
 </code> </code>
  
-**Non-patched**+**Current (trunk)**
 <code> <code>
 empty_loop         0.798 empty_loop         0.798
Line 129: Line 137:
 </code> </code>
  
-===== Proposal and Patch =====+===== Patch =====
  
-Comming soon+http://felipe.ath.cx/diff/tsrmls-fetch-reduction.diff
  
 ===== Changelog ===== ===== Changelog =====
rfc/tsrmls-fetch-reduction.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1