Deutsch   English   Français   Italiano  
<vja7at$143ok$2@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Tue, 10 Dec 2024 20:12:15 +0000
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <vja7at$143ok$2@dont-email.me>
References: <vi54e9$3ie0o$1@dont-email.me> <viifv8$2opi7$1@dont-email.me>
 <vik28b$390eg$1@dont-email.me> <vik8tc$3ang9$1@dont-email.me>
 <vikjff$3dgvc$1@dont-email.me> <viku00$3gamg$1@dont-email.me>
 <vil0qc$3fqqa$3@dont-email.me> <vil82t$3ie9o$2@dont-email.me>
 <vila9j$3j4dg$1@dont-email.me> <vin4su$49a6$1@dont-email.me>
 <vin95m$5da6$1@dont-email.me> <vinh3h$7ppb$1@dont-email.me>
 <vinjf8$8jur$1@dont-email.me> <vip5rf$p44n$1@dont-email.me>
 <viprao$umjj$1@dont-email.me> <viqfk9$13esp$1@dont-email.me>
 <vir5kp$3hjd9$1@paganini.bofh.team> <vishtd$1mnq1$1@dont-email.me>
 <visola$1ohbl$1@dont-email.me> <vivdb8$2foo6$1@dont-email.me>
 <viviqe$2gvqj$1@dont-email.me> <vj1rq0$35lal$2@dont-email.me>
 <vj9hag$vq6e$1@dont-email.me> <vj9ph3$114ip$2@dont-email.me>
 <vja6u2$143ok$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 10 Dec 2024 21:12:13 +0100 (CET)
Injection-Info: dont-email.me; posting-host="a9d7aded457bf5b4ebdaf1c3a45d65c6";
	logging-data="1183508"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/tTPdHd5hfV1FM39v9LRIJ"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Cut87fhvbpNWb8PXCsOmcKywuVs=
Content-Language: en-GB
In-Reply-To: <vja6u2$143ok$1@dont-email.me>
Bytes: 5325

On 10/12/2024 20:05, bart wrote:
> On 10/12/2024 16:16, David Brown wrote:
>> On 10/12/2024 14:56, bart wrote:
>>> On 07/12/2024 16:06, David Brown wrote:
>>>> On 06/12/2024 20:20, Bart wrote:
>>>
>>>>> If your task to get from A to B was split into two, you'd be happy 
>>>>> to do the first part by a fast car, then complete the rest of it on 
>>>>> a horse and cart, for no reason at all?
>>>>>
>>>>
>>>> The comparison was between C to object code (with a real compiler) 
>>>> and from X to C and then to the object code (using a real compiler). 
>>>> If your beliefs were true that gcc (and other proper C compilers) 
>>>> are incredibly slow, why would it make any difference if someone is 
>>>> starting from X or starting from C?  In both cases, compilation 
>>>> would take a long time - C compilation speed is neither more nor 
>>>> less important whether you are programming in X or C.
>>>
>>> You don't appear to get it.
>>
>> No, /you/ don't get it.  I did not say that people using language X 
>> don't care about the speed of C compilation.  I said it doesn't matter 
>> any more or any less than for people writing C.
>>
>>> If you are writing C by hand, then people like you would want to use 
>>> a more powerful, and therefore slower, compiler, that will analyse 
>>> that C. It can also take care of the many shortcomings in the language.
>>>
>>> But if the C has been machine-generated, that analysis is no longer 
>>> relevant. Then you may just want the fastest and simplest conversion.
>>>
>>
>> As I said before, the analysis is needed for good optimisation -
> 
> And as I said before, optimisation is very often not needed.
> 
> 
>> generating static error checking takes very little extra time when you 
>> are optimising.  And often people using C as an intermediary language 
>> want optimisation of the C code.
> 
> That's a benefit of it yes, but there's also a cost.
> 
> It depends a lot on how everything works. But if I take an old project 
> of mine that uses a C transpiler, and apply it to compiler projects that 
> I won't bore you with, I get these timings:
> 
>     C compiler:  Overall  (C compilation) Runtime
> 
>     cc           0.17       0.08           1.29   secs
>     tcc          0.27       0.18           1.56
>     gcc-O0       2.63       2.54           1.34
>     gcc-O2      12.6       11.7            0.8
>     gcc-O3      16.8       15.9            0.8
> 
> The intermediate C is one file. Transpiling to that C takes 0.09 seconds 
> in all cases. 'cc' is my newest C compiler (here beating tcc on 'busy' 
> generated code, but that is not typical).
> 
> The runtime is that of running on my largest test input, an extreme 
> test. Most inputs are a fraction of the size but finish too quickly to 
> measure easily.
> 
> For comparisons, the timings for my normal compiler, going straight to 
> EXE and not via C, are:
> 
>     mm           0.9       ----            1.03
> 
> Using tcc-compiled intermediate C would still give a reasonable 
> development experience. Using even gcc-O0 100s of times a day would be 
> very annoying, for zero benefit.
> 

Here are somebody else's results:

"V compiles ≈80k (Clang backend) and ≈400k (x64 and tcc backends) lines 
of code per second. (Apple M2, no optimization)"

From: https://vlang.io/

In this case the benefit appears to be 5x as fast using tcc.