rfc:tsrmls-fetch-reduction

This is an old revision of the document!


Request for Comments: TSRMLS_FETCH() reduction

  • Version: 1.0
  • Date: 2010-09-09
  • Author: Felipe Pena felipe@php.net
  • Status: Under Discussion

Introduction

The purpose of RFC is to show a way to reduce several function call by avoiding useless TSRMLS_FETCH() usage.

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.

Current function/macro New function/macro
emalloc emallocts
ecalloc ecallocts
pemalloc pemallocts
erealloc ereallocts
efree efreets
estrdup estrdupts
estrndup estrndupts

Benchmark

Zend/bench.php Patched Current
simple 0.487 0.562
simplecall 1.697 1.971
simpleucall 1.827 2.152
simpleudcall 1.879 2.198
mandel 1.950 2.286
mandel2 3.001 3.719
ackermann(7) 1.426 1.874
ary(50000) 0.260 0.256
ary2(50000) 0.201 0.239
ary3(2000) 1.506 1.758
fibo(30) 5.065 5.618
hash1(50000) 0.335 0.364
hash2(500) 0.295 0.369
heapsort(20000) 0.791 0.925
matrix(20) 0.697 0.765
nestedloop(12) 0.921 0.976
sieve(30) 1.077 1.146
strcat(200000) 0.130 0.148
Total 23.547 27.328

Proposal and Patch

Comming soon

Changelog

2010-09-09: Started.

rfc/tsrmls-fetch-reduction.1284074029.txt.gz · Last modified: 2017/09/22 13:28 (external edit)