Liste des Groupes | Revenir à l c |
On 10/12/2024 16:16, David Brown wrote:Here are somebody else's results:On 10/12/2024 14:56, bart wrote:And as I said before, optimisation is very often not needed.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 -
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.
Les messages affichés proviennent d'usenet.