2011/5/25 Ferenc Kovacs <i...@tyrael.hu>:
>
>
> 2011/5/25 Hannes Magnusson <hannes.magnus...@gmail.com>
>>
>> Hi all
>>
>> I'm still looking at ways to optimize PhD..
>> By remove all the class constant lookups we can shave off 9-10%..
>> Thats 8-9 seconds on my laptop (for a full build).
>>
>> It does however make the code slightly weirder to read, so I'm
>> wondering if you guys think its worth it?
>> I did add comments to Reader.php explaining what those seemingly
>> random numbers mean.. and the other constants we use are for the
>> namespace declarations...
>>
>> See the attached patch.
>>
>> -Hannes
>
> hi.
> how much would we gain with "real" constants (eg. define)?
> my biggest concern would be the code duplication, and that it would be
> harder to keep everything in sync.

The biggest gain with replace it with literals is the lowercasing of
the classname, class lookup, and the hash lookup.
Unsure how much we would gain with defines.. a blindfaith guess would
be 2-3% less.


> maybe we could also do some kind of preprocessing, eg replace the constants
> with scalar values before running the script.


We could do shitloads of optimizations if we generated most of the
code, or moved some things into cpp macros, but it becomes so insanely
annoying to debug that I don't think its worth the benefits.

-Hannes

Reply via email to