[ale] Linux kernel

Jon "maddog" Hall jon.maddog.hall at gmail.com
Sat Nov 18 13:16:47 EST 2023


>As the saying goes: "premature optimization is the root of all evil (or at
least most of it) in programming"  - Donald Knuth

It depends on what you mean by "premature optimization".   Understanding
the underlying hardware and software of the system and avoiding
optimization bottlenecks when you are writing your code is something I
think Dr. Knuth would agree with.

In the architecture of the IBM 360/370 series of computer there were four
instructions that took an EBCDIC number and converted it to binary and back:

o EBCDIC to Binary Coded Decimal (BCD)
o BCD to Binary

Then converting back:

o Binary to BCD
o BCD to EBCDIC

Four of the most expensive operations in the system.

I had a friend who wrote a subroutine one time that needed a binary index
into an array.   He told the COBOL programmers to pass him a number
(PICTURE 99) which was passed as an EBCDIC number.

Too late he realized that he was forcing the system to do two very
expensive, needless conversions hundreds of millions of times a day.

When I pointed this out to him he had his head down in his hands.

md

On Fri, Nov 17, 2023 at 4:12 PM Ben Coleman via Ale <ale at ale.org> wrote:

> On 11/17/2023 2:20 PM, Charles Shapiro via Ale wrote:
> > Heh. Reminds me of the guy at one of my old gigs who spent several weeks
> > of coding and testing to replace all of the simple sequential loop
> > searches in a pretty big application with sorts + binary searches.   The
> > original application took several hours to finish. After his
> > optimizations, the new version took about fifteen minutes less time.
> > **Always** profile before you optimize!
>
> As the saying goes: "premature optimization is the root of all evil (or
> at least most of it) in programming"  - Donald Knuth
>
> Ben
> --
> Ben Coleman oloryn at benshome.net | For the wise man, doing right trumps
> http://oloryn.benshome.net/     | looking right.  For the fool, looking
> Amateur Radio NJ8J              | right trumps doing right.
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> https://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.ale.org/pipermail/ale/attachments/20231118/98d2350a/attachment.htm>


More information about the Ale mailing list