The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: krewat@kilonet.net (Arthur Krewat)
Subject: [TUHS] Array index history
Date: Fri, 9 Jun 2017 17:52:16 -0400	[thread overview]
Message-ID: <70047882-7de3-162d-c4b5-6b6f0b4c82fa@kilonet.net> (raw)
In-Reply-To: <e067d88d677a358404d7b561256e6e49c845c81f@webmail.yaccman.com>

On 6/9/2017 5:21 PM, Steve Johnson wrote:
> C's conventions provided a big improvement in code correctness with a 
> small cost when compared to assembler..

Being an assembler snob for a number of years when I first started 
programming, having started with MACRO-10 on a PDP-10 in high school, I 
was reluctant to consider C as an alternative.

At one point early on, I decided I would see what the difference was in 
actual performance. So, on an IBM-AT, I wrote two programs. Both did a 
wire-frame rotation of a 3D cube, rotating around both the X and Y axis. 
They both used my own graphics library written in assembler that used 
the basic BIOS graphics calls to draw lines in 3D.

One program was written in straight Intel 80286 assembler. The other, in 
C, C86 from Computer Innovations, Inc.

The straight assembler version, I wrote using double-word integers. One 
word for everything above the decimal point, one word for everything 
below the decimal point. Now, because of the loss of precision, and that 
I defined the matrices for rotation as static integers, after a few 
hundred iterations, the cube would start to deform but it was a proof of 
concept.

The C version, I used real sin(), cos(), but - the interesting part is 
that I didn't have a floating point coprocessor - so the floating point 
was emulated in the supplied math library.

The assembler version ran at a ratio of 3:4 compared to the C 
version.Meaning if the assembler version did X rotations in 3 minutes, 
the C version did it in 4 minutes. BUT - the C version cube didn't 
deform over time, because the accuracy was intact.

After that, I gave up on assembler except where critical. C as a concept 
did what I needed it to do ;)

On topic for this conversation is the fact that arrays in C are 
basically a perfect mapping to assembler. if you moved from assembler to 
C like I did, there was no concern over "arrays should start at 1". It 
was just intuitive anyway.

On the other hand, if you went from some other language to C, well, I 
can understand the alien-ness.

art k.








  reply	other threads:[~2017-06-09 21:52 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.882.1496854900.3779.tuhs@minnie.tuhs.org>
2017-06-08 18:20 ` David
2017-06-08 18:55   ` Ron Natalie
2017-06-09 21:21   ` Steve Johnson
2017-06-09 21:52     ` Arthur Krewat [this message]
2017-06-08 22:29 ` Johnny Billquist
2017-06-08 23:16   ` Ron Natalie
2017-06-08 23:41     ` Steve Nickolas
2017-06-09 15:12       ` Random832
2017-06-09 16:30         ` Ron Natalie
2017-06-09  0:21     ` Johnny Billquist
2017-06-09  0:25     ` Pete Turnbull
2017-06-09  1:19       ` Toby Thain
2017-06-09  2:14         ` Pete Turnbull
     [not found] <mailman.890.1496953026.3779.tuhs@minnie.tuhs.org>
2017-06-08 22:28 ` Johnny Billquist
2017-06-08  9:16 Richard Tobin
  -- strict thread matches above, loose matches on Subject: below --
2017-06-08  2:27 Doug McIlroy
2017-06-08 12:49 ` William Cheswick
2017-06-08 12:56   ` Michael Kjörling
2017-06-08 13:45     ` Dan Cross
2017-06-08 13:57       ` Ron Natalie
2017-06-10 21:08     ` Nemo
2017-06-08 15:04   ` Dave Horsfall
2017-06-08 15:09     ` William Pechter
2017-06-08 16:53     ` Steve Nickolas
2017-06-08 20:17     ` Larry McVoy
2017-06-09  0:03     ` Greg 'groggy' Lehey
     [not found] <CAH_OBiewwwS6kbdWKUO-j3v=Do+Y9AzBn4ZkyVic7LOJN5WX7w@mail.gmail.com>
     [not found] ` <CAH_OBid5q-YeB6UYeOfjW68s3nb3TX_icC5dFMapfo=7_q5DUQ@mail.gmail.com>
     [not found]   ` <CAH_OBideJeNGiiys=VOEYcU1cffSg+6zDOD39HOU74vumQF0kA@mail.gmail.com>
     [not found]     ` <CAH_OBie_+dQXOC2OaZii5K=j1Ljmv-OvAVXvyypoLJ10jaysWA@mail.gmail.com>
     [not found]       ` <CAH_OBidXd1Lpgp8ttM3sWLfXDT0ms5EGAzEjPH9QkY+bXyev2w@mail.gmail.com>
     [not found]         ` <CAH_OBifge2RrwcDvSV46gwLAc0wHVtH++gdMBhXi-x8C0a_2jw@mail.gmail.com>
     [not found]           ` <CAH_OBic3MTy-20C_T2ciT2x+EjNZvXR2PJ0OzB0qRp1gd2OL-g@mail.gmail.com>
2017-06-07 12:56             ` shawn wilson
2017-06-07 13:16               ` Ron Natalie
2017-06-07 13:20               ` arnold
2017-06-07 13:50                 ` Michael Kjörling
2017-06-07 14:02                   ` arnold
2017-06-08 11:28                     ` Christian Neukirchen
2017-06-08 14:56                       ` shawn wilson
2017-06-07 14:58                   ` Tony Finch
2017-06-07 23:57                     ` Dave Horsfall
2017-06-07 16:31                 ` Lyndon Nerenberg
2017-06-08  0:47                 ` Bakul Shah
2017-06-07 17:59               ` Tim Bradshaw
2017-06-07 18:29               ` Clem Cole
2017-06-07 18:46                 ` Arthur Krewat
2017-06-07 19:03                   ` Ron Natalie
2017-06-07 19:15                     ` Arthur Krewat
2017-06-07 19:49                       ` Ron Natalie
2017-06-08  1:58                       ` ARJANEN Loïc Jean David
2017-06-08 13:49                       ` Random832
2017-06-08 13:55                         ` Arthur Krewat
2017-06-08 18:41                       ` Tim Bradshaw
2017-06-08  2:45                     ` Robert Swierczek
2017-06-08  4:05                       ` Dave Horsfall
2017-06-08  6:19                       ` Peter Jeremy
2017-06-08  7:02                         ` Dave Horsfall
2017-06-08 13:53                         ` Ron Natalie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70047882-7de3-162d-c4b5-6b6f0b4c82fa@kilonet.net \
    --to=krewat@kilonet.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).