home .. forth .. colorforth mail list archive ..

RE: [colorforth] FS/Forth for DOS: crude performance test


>Sorry for the late answer, unexpected holidays.

No problem, I've been away from my email too...I appreciate the assistance.

I kept hearing about "pigeon-hole optimization", and now I can see where
two inlined primitives will have xchg's that cancel out.

>
>I use BX as TOS and AX as data stack pointer:
>:CODE AND  ax sp xchg  cx pop  bx cx and  ax sp xchg  ret CODE.
>( that is xchg ax,sp  pop cx  and bx cx xchg ax sp ret )
>6 bytes, 23 cycles ( or 20 and don't rememeber if pop is 15 or 12 ) without
>ret
>:CODE DROP ax sp xchg  bx pop  ax sp xchg  ret CODE.
>With inlining + optimization one or both XCHG may disappear. Without
>optimization, it takes 3 bytes whereas your formula takes 5.
>
>One problem with BP is that in the instruction encoding a nul displacment is
>mandatory in all cases whereas it is not with [DI] and [SI]. OTOH you can
>sometimes take advantage of the fact that you can index down your data
>stack:
>: SWAP XCHG AX,[BP+2] ;
>But I guess you know that.
>
This is better than the SWAP I had. When I was first writing it, I thought
that INC affected the x86 flags, but it doesn't (at least not the zero flag)
So I was doing something strange like:

: XOR   INC BP  INC BP  XOR AX,[BP-2] ;

for example. Anyway, I'll be using the xchg instructions from now on ;)

>> keep the 
>> compiler simple.
>
>Take care of R> and THEN ( before ; ) when you'll implement tail recursion. 
>
>>  
>
> Amicalement,
>  Frederic
>

Sorry to everyone for wandering off-topic -- ColorForth. (Haven't been able
to get it to run, but I haven't tried some of the other modified versions
yet. I think one of them supports the old S3 video chip..)

Thanks for the help.

-Lonnie

>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
>For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
>Main web page - http://www.colorforth.com


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com