
Primeval C: two very early compilers - denzil_correa
http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html
======
gwern
These are very early compilers indeed, but it makes me wonder: a HN comment
today reminded me of 'Proebsting's law' that compilers double program speed
every 18 years. He got this by comparing a -O0 run with a -02 run and then
dividing, but the obvious problem with this is that even if a modern compiler
is run with -O0 it's probably going to be in effect optimizing a lot just by
all the architectural choices and default code generation. It would be
interesting to see if one could take a more recent C compiler, say late '70s
and compare it to a heavily optimizing GCC run, and answer the question: how
much have C compilers improved over the last 30-40 years?

~~~
kragen
I am pleasantly surprised to see that current GCC seems to be able to generate
code for a PDP-11 target. I think there may actually even be cycle-accurate
PDP-11 simulators around, which would enable you to do the benchmarking. If
you do get around to it, I'd love to hear your results!

~~~
vanderZwan
Aren't most optimisations hardware dependant, and if so: wouldn't it make
sense that the work put into these optimisations depends largely on how much
the hardware is used? Is the PDP-11 still a useful target in that sense?
Wouldn't the original x86 instruction set be more useful for example?

~~~
kragen
Well, if you want to compare a 1970s compiler to a modern compiler, the x86
instruction set will not be a useful target, since no 1970s compilers target
it. These particular ancient compilers target the PDP-11.

The larger question of whether optimizations are hardware-dependent is
interesting. In some sense, sure. But there are a lot of optimizations in
modern compilers that apply equally well to the PDP-11 and to the AMD64;
they're just not that different.

My homework assignment for you: write a C function of three or four lines
which loops over an array of structs and does some computation for each one,
including some conditional and a call to a one-line static function; compile
it with -c -O0 -Wa,-adhlns=unoptimized.lst and with -c -O5 -fomit-frame-
pointer -Wa,-adhlns=optimized.lst; list the optimizations you notice in the
difference between unoptimized.lst, and hazard a guess at which of them are
applicable on a PDP-11.

------
jacquesm
No css, no javascript, loads in a flash (pun intended), the way a web page
should be.

On top of that it contains mostly information rather than mark-up and eye
candy.

~~~
jrajav
Um, yes, and this kind of unstyled webpage is also the kind that makes me
twitch straight to my "Make Readable" CSS-forcing bookmarklet so that I can
read it in a legible size, line spacing, and line width, rather than having it
trawl all the way across my widescreen monitor in 12pt serif.

It can get exhausting keeping up with all of the silly CSS/JS web trends, I
realize, but there is a good reason for a lot of it.

~~~
zerohp
Your browser has awful defaults. There's no CSS, so your browser is
responsible for presenting it in a readable form.

~~~
derefr
I wonder if a popular web browser could get away with changing all its default
CSS rules to resemble modern readability guidelines, without breaking a large
majority of the web?

People who use CSS resets would be fine; people who use things like
normalize.css might have to go get a new version; but the rest of the internet
(which is implicitly relying on things like the line-height of <p>s and the
padding of <body>) might just spontaneously combust.

Then again, it might be fine to apply an alternate "default theme" _if and
only if_ there are literally no non-user-agent CSS styles defined on the page
(either by stylesheets or DOM-manipulating Javascript).

~~~
aaronblohowiak
>Then again, it might be fine to apply an alternate "default theme" if and
only if there are literally no non-user-agent CSS styles defined on the page
(either by stylesheets or DOM-manipulating Javascript).

That might be the way to go.

------
stormbrew
The fact that early pointer notation was just suffix [] is interesting. If
they'd stuck with that it would have avoided the a*b ambiguity.

~~~
xymostech
And if they hadn't, people would be confused about whether something's
supposed to be a pointer or an array. I think I like the current syntax much
better.

~~~
coldtea
> _And if they hadn't, people would be confused about whether something's
> supposed to be a pointer or an array._

Not that they aren' confused between pointers and arrays now.

------
leothekim
I just glanced at this: <http://cm.bell-
labs.com/cm/cs/who/dmr/last1120c/c10.c>

What is/was the purpose of the ospace() and waste() functions?

~~~
leothekim
Oh never mind, RTFA

------
limmeau
No "entry" keyword. I looked.

------
mortdeus
yeah, I found this last night and posted it on Reddit. Thanks for the cross
post. I have a github repo open for it I if anybody wants to fork. I won't
merge pull requests. github.com/mortdeus/legacy-cc

~~~
asveikau
Is it me or is it weird to say "thanks for the cross-post" for something
written by Dennis Ritchie?

~~~
mortdeus
As in thanks for linking it to hacker news, because I didnt after finding the
article last night.

~~~
asveikau
I read this article a few years ago, does that entitle me to recognition?
Obviously not. It just struck me as taking credit for non-accomplishments.

~~~
mortdeus
What are you even talking about? I was thanking the poster for doing something
I didnt do myself. This is the x-post I was talking about.

[http://www.reddit.com/r/programming/comments/19gnki/legacycc...](http://www.reddit.com/r/programming/comments/19gnki/legacycc_the_earliest_versions_of_the_very_first/)

I am not seeking any sort of recognition for the post whatsoever.

