Haha, GREAT!!! ;-)

Can the compiler auto-optimize it?

Patrick

On Nov 30, 2012, at 1:07 PM, Andi Jahja <andi.ja...@yahoo.co.id> wrote:

> 
> On Fri, 30 Nov 2012 10:09:10 +0100
> "Patrick Mast, xHarbour" <patrick.m...@xharbour.com> wrote:
> 
>> Hey Andi,
>> 
>>> 2012-11-30 06:12 UTC+0700 Andi Jahja <xharbour/AT/telkom/net/id>
>>> * include/hbcomp.h
>>> * source/compiler/harbour.c
>>> * source/compiler/genc.c
>>> * source/compiler/hbpcstat.c
>>>   + add poor-man's profiler, print message on how many opcode are used in 
>>> module being compiled
>>>     (the lesser the total pcodes, the more optimized the module would be)
>> 
>> THANKS!
>> I think the profiler is the most underestimated tool of xHarbour!
>> 
>> You can learn SO much from it!
> 
> Yes :-)
> 
> For an easy sample, I think sometimes ppl forget that we have iif()
> function.
> 
> The following snippet:
> 
> /** prog1.prg  **/
> procedure main
> 
> LOCAL A 
> 
> IF A == 1
>  b := 1
> ELSE
>  b := 2
> ENDIF
> 
> // requires: 12 pCodes
> /** end **/
> 
> But (with same functionality):
> 
> /** prog2.prg **/
> procedure main
> 
> LOCAL A, B := IIF( A == 1, 1, 2 )
> 
> 
> // requires: 11 pCodes
> /** end **/
> 
> We gain 1 pCode from the above. Imagine we have 1000 'IF's in some
> modules -> we'll save 1000 CPU cycles :-)
> 
> 
> Andi
> 


------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to