Sujet : Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]
De : minforth (at) *nospam* gmx.net (minforth)
Groupes : comp.lang.forthDate : 15. Sep 2024, 07:17:18
Autres entêtes
Organisation : novaBBS
Message-ID : <42d8a3bd5a96b1cfc0d77f0f3035feb7@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Rocksolid Light
On Sat, 14 Sep 2024 19:19:25 +0000, Ahmed wrote:
You are right.
I find with gforth:
>
: go 0 do -0.1e neg_big fdrop loop ;
>
without locals:
utime 100000000 go utime d>f d>f f- 1e-8 f* f. 0.06762074 us ok for 1e8
times: (67.62 ns)
>
and with locals:
utime 100000000 go utime d>f d>f f- 1e-8 f* f. 0.09961387 us ok for
1e8 times: (99.61 ns)
>
I missused the timing in the previous post.
Thanks for the correction.
So with gforth it's about 30 nanosecs runtime disadvantage.
IOW if you run the code 3*10^7 times it adds up to 1 sec disadvantage.
While the locals version was easy to code, pretty straightforward and
probably bug-free out of the box, how long did it take to code and debug
the stack juggling version?
Say 10 minutes longer. Break-even point would be around 2*10^10 runs,
and the dubious assumption that CPU time is as valuable as human time.