From: Kalus M. <mic...@on...> - 2011-04-03 10:38:27
|
Am 03.04.2011 um 12:27 schrieb D Nyberg: > I think you would also see a huge speed increase if you defined > constant > named "1" and tried it again too. That used to be standard in F79 and > 83, though it was more about size than speed. > > On 4/3/2011 4:16:17 AM, pito (pi...@vo...) wrote: >> : exa1 1 1 + . ; >> compilation 55sec (avrstudio window hidden) >> run ~0.3sek >> >> : exa2 1000 1000 3000 + - . ; >> compilation 78sec (avrstudio window hidden) >> run ~0.3sek >> >> Quite surprised the write to flash works with avrstudio >> simulator(v4, b716). I have ~250 words more in flash then the basic >> clean amforth 4.2 compilation. If we do it like ZERO we get: ; ( -- 1 ) Arithmetics ; R( -- ) ; leaves the value 1 on TOS VE_ONE: .dw $ff01 .db "1",0 .dw VE_HEAD .set VE_HEAD = VE_ONE XT_ONE: .dw PFA_ONE PFA_ONE: savetos PFA_ONE1: ldi tosl,1 ldi tosh,0 jmp DO_NEXT But a forth version compiles two cells shorter: ; ( -- 1 ) ; R( -- ) ; leaves the value 1 on TOS VE_1: .dw $FF01 .db "1",0 .dw VE_HEAD .set VE_HEAD = VE_1 XT_1: .dw PFA_DOVARIABLE PFA_1: .dw $1 ; forth: ; 1 constant 1 Wonder which one is faster? Michael |