On 2004-09-26 15:46:06 +0200, Thies C. Arntzen <thies@thieso.net> said:
> On 2004-09-26 03:05:18 +0200, Andi Gutmans <andi@zend.com> said:
>
>> I'll see which parts of your patch can be adapted for 5.1.x. I think
>> the var lookup is probably the most substantial one but I will probably
>> implement it slightly different. I'll mail internals@ when I have
>> something.
>
> this needs to get fixed in the compiler. (which sterling and i didn't
> want to touch)
>
> to make things good - we should always fetch the same variable into the
> same register (in the compiler). that way we could check if the
> register is already "loaded" and only fetch from the symbol-table if
> not. unless i'm missing something this should be relativly easy and it
> would work better (gain us more speed) than the hack sterly and i did.
>
> for real register-reuse we would have to do some basic flow-analysis,
> which i believe is too much science for PHP...
>
> re,
> tc
here we go - the worst hack ever (against php4 as i don't fully
understand the new executor)
(currently no support for functions calls;-)
what it does:
it remembers simple variable-fetches in the compiler and always fetches
the same var into the same register. (hackish as i added a new field to
the zend_op).
in the executor we cache those lookups into a global array (hence no
functioan call support) called "tubu".
what are the benefits?
- we save on temps as the same var is always fetches into the same temp
- we save a most hash-lookups for simple var acesses (loops etc)
is this the way to go andi?
tc
begin 644 worst_hack_ever.txt.bz2
M0EIH.3%!62936?Q\S`8``V_?@$`P>7__^__OWUJ_[]_Z8`?_>%IIH&A6@T``
M``+"4U")J:#U`VB-!HT&F:09`T#0:`T](,<`PC":8A@$`R`&$:9,F$8"&AP#
M",)IB&`0#(`81IDR81@(:#3TD$D])/4>4](,@:>H:-&3":````,AP#",)IB&
M`0#(`81IDR81@(:"1(("9!-,F@!-#11^BFTAZC:>E'BCU&C;4U&D"8L1&1RR
MD,K,:DG)1`-J414/[?!-LK02K9LD0A,"6Q2FVG!HHTIHVF@;@(!3+D&P4\JR
M"%2FV2I9-*,5"&)"(5Q+F%0J5G1SY!TBUF"!0(G!J[<(NTG9H@?7ZW4VJ^3=
MRJ5B1GS@`>^GYTYE=]#4U\*76XEJUZ]?V"J7*`;6A$#2&)IBX"P^+4T?3?J[
M0MISL54@FK0LO:#*G&WNX*/L4CR*(?,W&M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