[Rt-devel] [PATCH] Perfomance improvement of Tickets->_parser
call.
Ruslan U. Zakirov
cubic at acronis.ru
Wed May 12 14:03:16 EDT 2004
Robert Spier wrote:
>>1) Get rid from copy of incoming args in _match.
>>2) Decrease _match() calss.
>> 1) $curent = XXX if(_match) sequence changed to if(_match)
>> {$current = XXX} elsif(_match) sequence in reverse order. So one
>> _match on loop step.
>>
>> 2) implement $want check before _match, bin logic op surely faster
>> then (sub call+regexp). This also descrease _match calls.
>>
>>3) base reqexps refactoring. [><=] better then (?:>|<|=).
>>4) another small things.
>
>
> These are all microoptimizations and I highly doubt they're causing
> the time difference you're seeing. Some of them make the code harder
> to read or less consistent, which is a negative.
Say it Linux Kernels developers especially about __* subs :)
_parser and _match are private calls. Exactly this calls should be as
fast as posible, because they do work that in genaral case RT shouldn't
do: deparse SQL query to finaly produce same SQL query. I don't complain
on RT waste CPU time at all.
If you look on profile then you see that _match called 60000 times
without patch. it's simple redexp check, it should be inline, but perl
can't inline such code so IMHO it should be optimized or better inlined
by hands. Wasting ticks. PARSER which do useless calls is *bad* parser.
Patch decrease number of calls ~3times and makes them only when it's
really needed.
I never see CodingStyle guidelines which say "readability has advantage
over code sanity".
_parser implement $want flag, but doesn't use this, patch fix this issue.
I wrote comments about four different issues, but you just say that it
all is crap. sad.
Good luck. Ruslan.
>
> -R
More information about the Rt-devel
mailing list