Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not so much a bug, as slow!
#4
britlion Wrote:This program was posted on the WOS forums:

Code:
For x=-100 To 100
For y=-100 To 100
If (x/2-25)*(x/2-25)+(y-50)*(y-50)<200 Or (x/2+25)*(x/2+25)+(y-50)*(y-50)<200 then plot x+100,96-y
Next y
Next x

And if run as is, takes about 9 seconds in Basic, I think.
I've run the above code in Sinclair BASIC, and it takes 688secs. (11min. 20secs. aprox.)
[Image: slowrun.th.png]

This is the listing:
[Image: slowlisting.th.png]

In ZX Basic, by default it uses Byte type, it overflows, and produces a random pattern and an Out of Screen error at the end.
When declaring float, it works, but it takes *twice* the time it does with Sinclair BASIC. This is something I need to investigate further.
So using Integer is the way to go, and it takes about a minute (52 secs, as you said).

From my point of view, this is okay. There is some optimizations to be done there (e.g. common factors, etc.). I hope to have some more time to check for this.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)