Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1776

Re: Alternative C compilers on x86_64 Linux?

From BartC <bc@freeuk.com>
Newsgroups comp.compilers
Subject Re: Alternative C compilers on x86_64 Linux?
Date 2016-09-28 18:16 +0100
Organization A noiseless patient Spider
Message-ID <16-09-037@comp.compilers> (permalink)
References <16-09-001@comp.compilers> <16-09-033@comp.compilers> <16-09-034@comp.compilers> <16-09-035@comp.compilers>

Show all headers | View raw


On 28/09/2016 00:36, rugxulo@gmail.com wrote:

> TCC hasn't had a release in recent years either. It's fast because
> it does everything in one pass, and it does include it's own
> assembler and linker. It doesn't optimize well, though.

Compilers can be fast anyway. I think we've just got used to very slow
ones such as gcc. I've been using my own /interpreted/ compiler and it
was still double the speed of gcc!

I was reminded of how fast they can be when I recently developed a new
byte-code compiler, and managed up to a million lines per second
compilation speed (one test was 1.5Mlps). And that was on a low-end
5-year-old PC, running on a single core.

That was two passes; a compiler to native code would use an extra pass,
and probably the code-generating is a bit fiddlier. But I would estimate
source to in-memory native-code generation at at least 500K lines per
second on the same machine, if I was to give that compiler the same
treatment.

(And because this is not for C, I can use all of that throughput instead
of wasting it repeatedly compiling the same header files.)

However it is so fast that it would be necessary to consider carefully
what to do with the output: invoking an external assembler or linker
would be like hitting a brick wall. So it would need to generate an
entire executable directly or prepare code to run in-memory.

These fast compilers (the byte-code one I've completed, and the possible
native code one) will only compile an entire project at once. (Because
of dependencies, parallelising would be trickier. But at the minute it's
fast enough: the new byte-code compiler can entirely re-compile my
current native-code compiler from scratch in 0.03 seconds.)

But with C projects then yes, the range of fast tools is limited. It
doesn't help if you also become dependent on things such as 'configure'
or 'make' (I work in Windows where there is less of that).

Maybe it needs people with experience of fast graphics or rendering, who
know how to speed things up, and apply them to C compilers! The C
language does put some obstacles in the way (the same header needs to
processed for the 50th time in case something comes out different), but
I think there is plenty that can be done.

TCC does a good job, but it's a shame about the code generation. (My own
native code compiler has a naive non-optimising code generator but is
still much better than TCC's code.)

(One one test of the fast compiler, my own code can manage 800Klps.
Converting to C intermediate code then putting it through gcc -O3 gets
it up to 1Mlps. But compiling with TCC gets it down to 350Klps (TCC is
not good with switch statements). Not so bad, but still ...)

--
Bartc
[Back when I was publishing the Journal of C Language of Translation, people did some interesting
stuff with C header files, saving a precompiled version for the usual case that subsequent
runs don't change any preprocessor stuff that would affect the code. -John]

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-02 03:01 +0000
  Re: Alternative C compilers on x86_64 Linux? jacobnavia <jacob@jacob.remcomp.fr> - 2016-09-05 00:20 +0200
    Re: Alternative C compilers on x86_64 Linux? alexfrunews@gmail.com - 2016-09-05 17:26 -0700
      Re: diagnosing C errors, was Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-09 12:31 +0100
        Re: diagnosing C errors, was Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-09 16:06 +0000
        Re: diagnosing C errors, was Alternative C compilers on x86_64 Linux? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2016-09-10 00:38 +0200
  Re: Alternative C compilers on x86_64 Linux? Nemo <nemo@invalid.invalid> - 2016-09-04 18:32 -0400
  Re: Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-04 23:48 +0000
  Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-05 13:19 +0100
    Re: Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-06 02:15 +0000
      Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-06 21:35 +0100
        Re: dead code or otherwise, was Alternative C compilers on x86_64 Linux? George Neuner <gneuner2@comcast.net> - 2016-09-08 11:58 -0400
          Re: dead code or otherwise, was Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-08 22:54 +0000
            Re: dead code or otherwise, was Alternative C compilers on x86_64 Linux? George Neuner <gneuner2@comcast.net> - 2016-09-09 00:51 -0400
              Re: dead code or otherwise, was Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-09 06:05 +0000
                Re: dead code or otherwise, was Alternative C compilers on x86_64 Linux? George Neuner <gneuner2@comcast.net> - 2016-09-09 14:02 -0400
                Re: dead code or otherwise, was Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-09 19:57 +0000
      Re: duplicate cases, was Alternative C compilers on x86_64 Linux? Andy Walker <anw@cuboid.co.uk> - 2016-09-07 17:01 +0100
  Re: Alternative C compilers on x86_64 Linux? Florian Weimer <fw@deneb.enyo.de> - 2016-09-05 20:06 +0200
  Re: Alternative C compilers on x86_64 Linux? alexfrunews@gmail.com - 2016-09-05 17:22 -0700
    Re: Alternative C compilers on x86_64 Linux? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-09-06 02:18 +0000
  Re: Alternative C compilers on x86_64 Linux? rockbrentwood@gmail.com - 2016-09-07 17:00 -0700
  Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-12 18:42 +0000
    Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-12 22:37 +0100
      Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-13 17:35 +0000
        Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-14 18:14 +0000
  Re: Alternative C compilers on x86_64 Linux? rugxulo@gmail.com - 2016-09-26 15:29 -0700
    Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-27 05:40 +0000
      Re: Alternative C compilers on x86_64 Linux? rugxulo@gmail.com - 2016-09-27 16:36 -0700
        Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-28 18:16 +0100
          Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-29 14:03 +0100
            Re: Alternative C compilers on x86_64 Linux? George Neuner <gneuner2@comcast.net> - 2016-09-29 22:57 -0400
            Re: Alternative C compilers on x86_64 Linux? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2016-09-30 05:03 +0200
              Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-30 12:00 +0100
                Re: Alternative C compilers on x86_64 Linux? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2016-09-30 20:15 +0200
                Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-10-01 22:17 +0100
            Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-09-30 12:28 +0100
              Re: Alternative C compilers on x86_64 Linux? BartC <bc@freeuk.com> - 2016-10-17 22:49 +0100
        Re: Alternative C compilers on x86_64 Linux? George Neuner <gneuner2@comcast.net> - 2016-09-28 21:24 -0400
      Re: Alternative C compilers on x86_64 Linux? George Neuner <gneuner2@comcast.net> - 2016-09-28 01:01 -0400
        Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-29 02:55 +0000
      Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com - 2016-09-29 05:30 -0600
        Re: Alternative C compilers on x86_64 Linux? arnold@skeeve.com (Aharon Robbins) - 2016-09-30 10:13 +0000

csiph-web