"Nobody programs in machine language" (was: Modern

From: Fred Cisin <cisin_at_xenosoft.com>
Date: Tue Jun 22 02:01:41 2004

On Tue, 22 Jun 2004, Sean 'Captain Napalm' Conner wrote:
> I would expect that an expert driver would need to have an understanding
> of how the engine relates to the rest of the car, in addition to
> understanding how the transmission and breaks relate.

That is exactly my point in this strained analogy!

> Yes, understanding
> how the car works overall helps, but the ability to rebuild an engine? I
> have to be sold on that one ...

I wouldn't try to sell you on that. A basic understanding is
essential, but a high level of skill and experience doesn't
necessarily give much further benefit.

> In 1992 when Doom came out, it only had two (2) routines hand coded in
> assembler---the rest was in C.

How good would it have been without them?
Would modern (fast) hardware be adequate instead?

> Algorithmic optimizations, which is where you now get the most benefit.
> An extreme example would be replacing a bubble sort with quick sort (for a
> sufficient amount of items to be sorted). I remember several years ago
> working on a project (in C) that wasn't as fast as the previous
> implementation (also in C). Instead of reaching for assembly (which I could
> have done) I instead profiled the program---finding out which parts of the
> program where the actual hot spots instead of my guessing where the hot
> spots were. I basically converted seven small routines into macros (inline
> the code, instead of having a function call overhead) and easily doubled the
> speed, bringing it into line with the previous implementation (which had
> fewer features by the way).

I maintain that your basic understanding of machine language is
largely responsible for your understanding of what would help.
Leastwise, the easiest way that I know of to show students the
performance benefit of macros is to show them what is involved
in function call overhead - in other words, understanding some
aspects of of the machine language that the compiler produces.


> regret learning assembly? Not at all, I think it made me a better
> programmer, but that's me.

Well, that is my main point, even if some of my statements are
arguable. My basic premise is that even without doing any
assembly language coding, an understanding of machine language
improves the quality of programming in higher level languages.

> I think the reason assembly isn't taught anymore is that industry (or
> academia) don't see it worth the time and effort to. Right now, the most
> expensive component in programming is the programmer, and anything to make
> the programmer more productive is seen as a good thing, and the one thing
> that makes a programmer productive is working with higher and higher level
> languages.

Yeah.
I don't like to face the fact that Microsoft's switchover
15 years ago to "throw hardware at it" is actually the way
things are going to be from now on.


> I would contend that it's cheaper to buy the faster hardware than to keep
> me on staff (or rather, it's more cost effective to have me doing other

Yeah.
hardware is now cheaper than skill


> > What do you think "optimization" means?
> Trade-offs. Right now, the optimization being done is developer time and
> expertise. Faster with less skilled programmers. Or in other words:
> Good. Fast. Cheap. Pick two.

I still like to teach optimizing for speed, size, or
simplicity/ source code readability


> -spc ("Premature optimzation is the root of all evil."
> ---Donald Knuth)
Good quote.
I have to spend some time teaching students to optimize for
readability and simplicity, and to not try to make it fast
until it works.

--
Grumpy Ol' Fred     		cisin_at_xenosoft.com
Received on Tue Jun 22 2004 - 02:01:41 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:59 BST