[Coco] Question about BASIC coding guidelines

wdg3rd at comcast.net wdg3rd at comcast.net
Sat Nov 1 01:42:47 EDT 2008


From: theother_bob <theother_bob at yahoo.com>
> I don't know about that for sure, but I can say from first hand benchmarking 
> that it speeds Basic up to use Hex numbers instead of decimal. To prove it, try 
> the following benchmarks:
>  
> 10 TIMER=0:FOR X=1 TO 1000:N=&HC0C0*&H2:NEXT:T=TIMER;?T
>  
> 10 TIMER=0:FOR X=1 TO 1000:N=49344*2:NEXT:T=TIMER:?T
>  
> I'm not actually running these now, but I'm confident you will see a faster time 
> on the first example in RS Basic.
> 
> For Benchmarking especially, it is best to eliminate as much OS overhead as 
> possible. Keep lines to the least (and lowest) number possible, put subroutines 
> at the beginning of the program, declare frequently used variables first... all 
> good practices I have experienced noticeable improvements from. There are also 
> some POKEs that can make really major speed and security improvements in Basic.

Most of this is not unique to CoCo BASIC, it  (aside from the 6809 hispeed poke, which doesn't change how BASIC works, it just heats up the CPU)  is common to _all_ of the Microsoft interpreted BASICs.  From Altair to GWBASIC with the side-trip to Model 100 BASIC.  I never played with QuickBASIC much, I don't know how it did things, and of course once you get to Visual "BASIC" it's a whole new (and not my) cup of poisoned meat (I can mix up references as well as any politician).

I remember when we weren't that concerned about how fast it worked, as long as it worked -- once things were stable, then we'd tweak.  Carefully.  Especially on production systems.

What's this about security POKEs?  Do you mean making programs unLISTable?  Those were all easily broken (well, actually, the philosophy which inspired them was broken to begin with, handicapping the players in that game).
--
Ward Griffiths    wdg3rd at comcast.net

"What I know [about the art of the sword] boils down to this:  If you see a guy running at you with a sword, put two rounds in his chest to slow him down, then one into his brain to finish him off".  Aaron Allston, _Sidhe Devil_



More information about the Coco mailing list