🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #15

Re: Taming The Switch-Statement

#15
From: David Brown
Date: Wed, 07 Oct 2026 07:07
53 lines
3822 bytes
On 07/10/2026 02:25, bart wrote:
> 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.
> 
I can't answer for other people, but when I write code, usually there is 
a fair amount of difference between different lines.  The time taken for 
a compilation depends on the code!

You can do all the speed measurements you like using files made from 
thousands of copies of the same pointless function.  It means /nothing/.

"Lines per second" is a good way to rate machines for painting dashed 
lines down the middle of a road - not a way to judge a compiler.

Your tools are useless to everyone except you.  No one cares if they are 
a million times faster at being useless, people need tools that do 
something useful to them.

So for the love of $DEITY, give it a break!  You write plenty of 
interesting posts - your addiction to milliseconds is not part of that.



Technical Details
Message-ID: <11a4r3i$2k7oa$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> <11a43hl$2e5k2$1@dont-email.me>

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: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: Taming The Switch-Statement
Date: Wed, 7 Oct 2026 09:07:30 +0200
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <11a4r3i$2k7oa$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> <11a43hl$2e5k2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 07 Oct 2026 07:07:31 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2760458"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19nk5PNIemHTE0fGUHxs9rzuqSolJJO9hE="; posting-host="fd0a1bf01e024f2af36d0493face3db6"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ceht+XgcsmvYGeeaxT+7AqP2Wnk= sha256:T6WXbECrWyS5Z5+3minEotjx6dIypwzv6XYrgTmmio0=
	sha1:nb1MQZD9VYi37cmYtnQj0BhIt4Y= sha256:H6PIRW/N1997eIC41xOBcVpKujQJ8yDh32tda2992GY=
In-Reply-To: <11a43hl$2e5k2$1@dont-email.me>
Content-Language: en-GB, nb-NO