9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Brantley Coile <brantleycoile@me.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Compiling ken-cc on Linux
Date: Sat, 28 Nov 2015 02:40:31 -0500	[thread overview]
Message-ID: <0962EE36-1765-440C-816F-90DEF0A5720D@me.com> (raw)
In-Reply-To: <CALj3Nd3R1BUyHiwbUkTiTQvdiO-670VxU_tDx-M8GRxvLCKPJA@mail.gmail.com>

Great point. And you actually don’t meet the minimum requirement for snarky messages.

You argue the the large compilers are due to the increase in the complexity of the specification and the complexities of generating code for the Intel instruction set. To some extent you are correct. A modern C compiler would be larger than a PDP-11 compiler. In fact, I would argue it should be about twice the size of the PDP compiler.

I’m kind of cheating when I say that, because I know for a fact that a ANSI C compiler would be that much larger because that’s about the size of the Plan 9 C compiler compared to the PDP-11 compiler. The 7th Edition C compiler was about 12,000 lines. Plan9’s compiler for the 64 bit x86 instruction set is 22,000 lines of source.

One could argue that the Plan 9 C compiler lacks the modern optimizations that the other compilers have. This would be true. But I would argue that almost all of those optimizations are either not needed because the coder could have optimized his code in the first place, or are way past the point of diminishing returns. So, I would say that those optimization fill a much needed gap.

Niklaus Wirth pointed out that the best characteristic of a language used to create very efficient programs is predictability. This is especially true for the modern architectures. We are much smarter than any compiler will ever be and the knowledge of the micro architecture is required to write the fastest code. (It doesn’t really change that fast over the years.) The programmer does the work. That predictability is best delivered when the compiler only optimized inefficiencies it generates and not try to outsmart the programmer.

I for one really enjoyed your point. 

  Brantley

> On Nov 28, 2015, at 1:42 AM, da Tyga <cyberfonic@gmail.com> wrote:
> 
> I have been following this discussion about the C compiler and can no longer stop myself from making a (snarky?) comment.
> 
> The K&R standard for C was very much written when the C language was a higher than assembler language for the PDP-11 (at least that's how I became acquainted with it back in 1976).  Most of us, in those days, welcomed something that was more high level than macro-assembler and yet amenable to writing operating systems and utilities (unlike FORTRAN, ALGOL and COBOL of that era).  Many of us would use the -s switch to check the generated assembler code and in some cases even modify the assembler code for selected functions to get exactly the desired result.
> 
> The PDP-11 had a rather simple instruction set, thus the compiler produced relatively predictable code.  The undefined behaviours in many cases meant that at least on the PDP-11 we would know what to expect.  It was only once code was ported to other systems that these assumptions started getting sorely tested.
> 
> Fast forward to present time, we have a bloated C standard and even more bloated C++ standards.  The target instruction sets are rich with lots of special case instructions; out of sequence execution; multi-level caches add further constraints.  So today's compilers need to analyse complex source code to run with good performance on extremely complex targets.  We shouldn't forget that in the case of the x86 family the compilers need to optimise for an ever evolving instruction set and retain backward compatibility across earlier variants.
> 
> 
> On 28 November 2015 at 12:01, erik quanstrom <quanstro@quanstro.net> wrote:
> > Funny, but actually I was wondering if there is any subtle issue in the
> > standards of the C language that makes it somehow hard to implement.
> > For example I've met a few times weird implementations of libraries and
> > frameworks dictated by broken standards: once they are in, they can never
> > be removed due to backward compatibility. I thought that Charles (that also
> > implemented the Limbo compiler) might have referenced these kind of issues
> > in his pun.
> 
> i think the simple answer is: no.  but many folks just love complexity, and are
> determined to find it.  if you give such a person one problem, they'll come back
> with two problems.  i call these folks complicators.  don't be a complicator.
> 
> (i have to remind myself this from time to time.)
> 
> - erik
> 
> 




  reply	other threads:[~2015-11-28  7:40 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-28  6:42 da Tyga
2015-11-28  7:40 ` Brantley Coile [this message]
2015-11-28 20:31   ` Anthony Sorace
2015-11-28 23:33     ` Brantley Coile
2015-11-29  6:12       ` lucio
2015-11-28 20:13 ` Ryan Gonzalez
2015-11-29  5:57   ` lucio
2015-11-29 16:17     ` tlaronde
  -- strict thread matches above, loose matches on Subject: below --
2015-11-25 17:10 Vasudev Kamath
2015-11-25 17:15 ` Ryan Gonzalez
2015-11-25 17:24   ` Vasudev Kamath
2015-11-26 12:08     ` Charles Forsyth
2015-11-27 16:50   ` Vasudev Kamath
2015-11-27 16:59     ` Ryan Gonzalez
2015-11-27 17:16       ` Vasudev Kamath
2015-11-27 18:24         ` Ryan Gonzalez
2015-11-29  9:41           ` Vasudev Kamath
2015-11-29 14:38             ` Ryan Gonzalez
2015-11-27 18:11   ` trebol
2015-11-26 12:10 ` Charles Forsyth
2015-11-26 12:18   ` David du Colombier
2015-11-26 18:15   ` Ryan Gonzalez
2015-11-26 21:31     ` Charles Forsyth
2015-11-26 21:49       ` Ryan Gonzalez
2015-11-26 21:51         ` Charles Forsyth
2015-11-26 21:56           ` Charles Forsyth
2015-11-26 22:02             ` Ryan Gonzalez
2015-11-26 22:08               ` Charles Forsyth
2015-11-26 22:30                 ` David du Colombier
2015-11-26 23:08                   ` Ryan Gonzalez
2015-11-26 23:21                     ` Charles Forsyth
2015-11-26 23:41                       ` Ryan Gonzalez
2015-11-27  0:02                       ` Brantley Coile
2015-11-27  8:13                       ` Giacomo Tesio
2015-11-27  8:56                         ` arnold
2015-11-27 13:33                           ` Steffen Nurpmeso
2015-11-28  0:55                             ` erik quanstrom
2015-11-30 15:46                               ` Steffen Nurpmeso
2015-11-27 12:42                         ` tlaronde
2015-11-27 14:07                           ` Giacomo Tesio
2015-11-27 14:34                             ` tlaronde
2015-11-28  1:01                             ` erik quanstrom
2015-11-27 12:05                       ` Steffen Nurpmeso
2015-11-27 12:32       ` lucio
2015-11-26 21:40     ` Andrew Simmons

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=0962EE36-1765-440C-816F-90DEF0A5720D@me.com \
    --to=brantleycoile@me.com \
    --cc=9fans@9fans.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).