Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #1040

Re: Suggestions for improving speed of .SYS program.

From David Schmidt <schmidtd@my-deja.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: Suggestions for improving speed of .SYS program.
Date 2014-01-03 08:15 -0500
Organization A noiseless patient Spider
Message-ID <la6d5p$fcs$1@dont-email.me> (permalink)
References <la0kks$qcu$1@news4.open-news-network.org> <b7597448-6d38-4a44-a4eb-a61bbc2f5707@googlegroups.com> <la1q0p$afb$1@news4.open-news-network.org> <la1uni$bnt$1@speranza.aioe.org> <la5tgq$e5h$1@news4.open-news-network.org>

Show all headers | View raw


On 1/3/2014 3:42 AM, Matt wrote:
> On 02/01/14 09:44, Bill Buckels wrote:
>> Remember this thing never really took-off on the
>> Apple II. No C compiler did.
>
> Bearing that in mind I want to take a step back and ask: Am I even using
> the right tools for the job? I was a software user when I had a //e,
> everything I've learned about programming has come from experience with
> GNU/Linux on x86 machines.

The right tool for the job, at least at first, is the one that you're 
comfortable with.  If raw speed is what you crave - you need finely 
tuned assembly language.  If turn-efficiency is what turns you on - then 
the algorithm discussion in http://sartak.org/nh/mastermind.html is 
where it's at.  I don't know if Breadth3 would actually execute faster 
than Naive4 - the amount of time spent on each "turn" for each algorithm 
isn't listed; only the number of turns required.  They're different for 
each of the algorithms: execution speed wasn't sartak's goal.  Turn 
efficiency was.

> Say the goal back in the day had been to produce a mastermind game
> running on the //e for the educational software market, which employed
> the knuth algorithm as the ai for the computer opponent. What tools
> would you Bill have chosen. What would other developers have chosen?

Not-Bill answer: no sense in leaving something in BASIC.  If I weren't 
capable of writing in assembly, I would at least have some form of 
compiled language so the laziest of my customers couldn't simply LIST my 
code.  Understanding of course anyone one square to the right of lazy 
can read a disassembly.

> Maybe I'd be just as well writing it in applesoft basic? I just assumed
> C, compiled, fast. Basic, interpreted, slow. But I'm starting to realise
> that many of my assumptions don't apply when it comes to programming the
> //e.

If you write a good algorithm in BASIC, using some tuning techniques 
like unrolling loops and keeping loop contents as simple as possible 
(because they run lots of times), using variables instead of constants, 
and so on - then you'll likely have a passable result.  You can speed 
that up quite a bit with an Applesoft compiler essentially for free - no 
need to learn anything else.  In the end, you need to be able to turn 
your algorithm into code; naive algorithms are really easy to do in 
BASIC, but finely tuned ones that really leverage the machine 
architecture will not come from any interpreter or compiler.  And a 
crappy algorithm will behave crappily in whatever language it starts out in.

I'll leave you with an example from Michael Mahon and Scott Hemphill, 
who in 2006 wrote a Sodoku solver in assembly.  It started from an 
algorithm in C, and progressed through ever more clever assembly 
iterations.  In the end, it is a fairly brute-force solver that doesn't 
try to be perfect in terms of turn efficiency - it tries out a bunch of 
possibilities and sees what the outcome is.  It doesn't spend undue 
amounts of work to thin out the game tree; and in the Apple II's case, 
for this solution space, it paid off handsomely.

http://home.comcast.net/~mjmahon/Sudoku.html

What was the right language for this?  They ended up using quite a few 
of the 6502's characteristics that probably would have been awkward in a 
higher-level language; or at least it would require a way to shake free 
of a compiler and simply say "pass this to the assembler instead..."

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-01 21:40 +1300
  Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-01 09:15 -0800
    Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-02 08:18 +1300
      Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-01 14:44 -0600
        Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-02 21:38 +1300
          Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-02 04:49 -0600
            Re: Suggestions for improving speed of .SYS program. Steven Hirsch <snhirsch@gmail.com> - 2014-01-02 07:26 -0500
              Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-02 18:23 -0600
        Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-03 21:42 +1300
          Re: Suggestions for improving speed of .SYS program. David Schmidt <schmidtd@my-deja.com> - 2014-01-03 08:15 -0500
            Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-03 10:26 -0600
            Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-04 10:47 +1300
              Re: Suggestions for improving speed of .SYS program. Michael J. Mahon <mjmahon@aol.com> - 2014-01-04 04:11 -0600
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-05 12:53 +1300
            Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-03 23:55 -0800
              Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-05 13:58 +1300
                Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-04 20:24 -0800
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-06 11:11 +1300
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-08 20:43 +1300
                Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-08 15:41 -0800
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-09 21:34 +1300
                Re: Suggestions for improving speed of .SYS program. Michael J. Mahon <mjmahon@aol.com> - 2014-01-09 03:42 -0600
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-11 17:12 +1300
                Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-10 23:59 -0800
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-12 07:47 +1300
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-12 11:39 +1300
                Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-11 16:43 -0800
                Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-13 13:57 +1300
            Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-03 23:50 -0800
        Re: Suggestions for improving speed of .SYS program. ol.sc@web.de (Oliver Schmidt) - 2014-01-08 20:08 +0000
          Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-08 18:39 -0600
            Re: Suggestions for improving speed of .SYS program. Oliver Schmidt <ol.sc@web.de> - 2014-01-09 00:55 -0800
              Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-09 05:51 -0600
          Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-09 21:44 +1300
            Re: Suggestions for improving speed of .SYS program. Oliver Schmidt <ol.sc@web.de> - 2014-01-09 01:20 -0800
              Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-09 05:56 -0600
                Re: Suggestions for improving speed of .SYS program. David Schmidt <schmidtd@my-deja.com> - 2014-01-09 11:09 -0500
                Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-09 09:29 -0800
                Re: Suggestions for improving speed of .SYS program. David Schmidt <schmidtd@my-deja.com> - 2014-01-09 12:48 -0500
                Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-09 18:17 -0600
                Re: Suggestions for improving speed of .SYS program. aiiadict@gmail.com - 2014-01-09 20:57 -0800
                Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-10 05:41 -0600
                Re: Suggestions for improving speed of .SYS program. David Schmidt <schmidtd@my-deja.com> - 2014-01-10 07:56 -0500
                Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-10 19:49 -0600
                Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-10 08:39 -0800
                Re: Suggestions for improving speed of .SYS program. aiiadict@gmail.com - 2014-01-10 15:58 -0800
      Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-01 22:28 -0800
        Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-03 08:40 +1300
          Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-02 18:33 -0600
          Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-02 21:05 -0800
            Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-03 20:20 +1300
  Re: Suggestions for improving speed of .SYS program. "Anton Treuenfels" <teamtempest@yahoo.com> - 2014-01-02 18:58 -0600
    Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-03 21:05 +1300
      Re: Suggestions for improving speed of .SYS program. "Anton Treuenfels" <teamtempest@yahoo.com> - 2014-01-03 18:17 -0600
        Re: Suggestions for improving speed of .SYS program. "Bill Buckels" <bbuckels@mts.net> - 2014-01-03 21:32 -0600
        Re: Suggestions for improving speed of .SYS program. gids.rs@sasktel.net - 2014-01-03 23:15 -0800
          Re: Suggestions for improving speed of .SYS program. "Anton Treuenfels" <teamtempest@yahoo.com> - 2014-01-04 19:30 -0600
        Re: Suggestions for improving speed of .SYS program. Matt <matt@clickertraining.co.nz> - 2014-01-05 12:50 +1300

csiph-web