🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #5

Re: Taming The Switch-Statement

#5
From: bart
Date: Wed, 07 Oct 2026 00:25
70 lines
3781 bytes
On 07/10/2026 00:14, Waldek Hebisch wrote:
> bart <bc@freeuk.com> wrote:

>> What program can gcc compile in 10ms, Hello World?
> 
> On my machine the following non-canonical version of Hello World:
> 
> #include <unistd.h>
> int
> main(void) {
>      write(1, "Hello\n", 6);
>      return 0;
> }
> 
> takes about 20-22 ms.  More realistically, compilation of a lead
> C program (66 lines) and linking of several .o files (many
> produced by a non-C compiler) + libc needs 23 ms producing
> 66 kB executable (of which 20 kB is code and the rest is mainly
> debug info).  The same, but linking statically to libc needs 56 ms
> and produces 550 kB executable (of which 413 kB is code).
> Note: the last two are for Risc-V.  That is compiler runs on my PC,
> but executables only run on Risc-V machine.  And actually
> transferring the executable takes more time than C compilation.

So, on your machine, what's the throughput of gcc in lines per second?

I mean something more accurate than the 300lps of your 6-line example 
which will be mostly due to overheads.

My compilers for Windows tend to work at up 0.5Mlps, and between 1-2 
magnitudes faster than gcc.


> 150 ms is still not too long.

I use Windows where it is 250ms (a bit lower now), and yet my own 
product works fine on it; this is my C compiler building sqlite3:

   c:\cx>tim bcc sql
   Compiling sql.c to sql.exe
   Time: 0.228

And this is gcc 14 building hello.c:

   c:\cx>tim gcc hello.c
   Time: 0.203

And gcc 10:

   c:\cx>tim \tdm10\bin\gcc hello.c
   Time: 0.244

And clang:

   c:\cx>tim clang hello.c
   Time: 0.263

Amazing isn't it that I can build a working SQL program in about the 
time it takes gcc/clang to build Hello, World! bcc is not even optimised.


>  And large part of it is likely to
> be gcc startup time, so you can make program larger whithout large
> increase of compile time.

Yes, it is big and slow and they haven't provided a fast path (like a 
secretly bundled version of tcc) when you need an instant, streamlined 
result.

Technical Details
Message-ID: <11a43hl$2e5k2$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <119qf6l$2rmg3$1@dont-email.me> <119r8u3$34nce$1@dont-email.me> <119rau4$35ugq$1@dont-email.me> <119uo2c$3kc0t$1@paganini.bofh.team> <119uqnv$d6j2$1@dont-email.me> <20261005143559.157@kylheku.com> <11a1arj$1e8ks$1@dont-email.me> <11a295r$1lqal$3@dont-email.me> <11a2e2m$ef4o$2@dont-email.me> <11a2j83$1qu9n$1@dont-email.me> <11a2maf$1soc7$1@dont-email.me> <11a2vrn$20jj3$1@dont-email.me> <EI7xS.906$aNSb.21@fx20.iad> <11a37gv$23ruj$1@dont-email.me> <11a3vcj$88e7$1@paganini.bofh.team>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Wed, 7 Oct 2026 01:25:25 +0100
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <11a43hl$2e5k2$1@dont-email.me>
References: <119qf6l$2rmg3$1@dont-email.me> <119r8u3$34nce$1@dont-email.me>
 <119rau4$35ugq$1@dont-email.me> <119uo2c$3kc0t$1@paganini.bofh.team>
 <119uqnv$d6j2$1@dont-email.me> <20261005143559.157@kylheku.com>
 <11a1arj$1e8ks$1@dont-email.me> <11a295r$1lqal$3@dont-email.me>
 <11a2e2m$ef4o$2@dont-email.me> <11a2j83$1qu9n$1@dont-email.me>
 <11a2maf$1soc7$1@dont-email.me> <11a2vrn$20jj3$1@dont-email.me>
 <EI7xS.906$aNSb.21@fx20.iad> <11a37gv$23ruj$1@dont-email.me>
 <11a3vcj$88e7$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 07 Oct 2026 00:25:26 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2561666"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18AWWlpwAnOQmOj6y6Ja4Jt"; posting-host="ddea08e9999a8df42a3f6de53c7cc773"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:AhEMyvXhs3v05sGF0b6Eda7WD9I= sha256:we+Y8UPAiqJQLcD2O1DfrOlPA5ffh/2tzcyYKwk6jug=
	sha1:ZwsnERbfzyWPPAaVH3mdF7NPTHw= sha256:9b3JmYCO3xKT3xahiVhcLji230ocwMyw7SPDMSBnIWQ=
Content-Language: en-GB
In-Reply-To: <11a3vcj$88e7$1@paganini.bofh.team>