Re: Suggested method for returning a string from a C program?

Liste des GroupesRevenir à cl c  
Sujet : Re: Suggested method for returning a string from a C program?
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.lang.c
Date : 27. Mar 2025, 01:22:44
Autres entêtes
Organisation : To protect and to server
Message-ID : <vs25oi$2pqb$1@paganini.bofh.team>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
Kaz Kylheku <643-408-1753@kylheku.com> wrote:
On 2025-03-26, Muttley@DastardlyHQ.org <Muttley@DastardlyHQ.org> wrote:
Whats this? You mean your amazing zippy fast compiler can't optimise for shit?
Maybe gcc isn't so bad after all eh?
 
Ah, but:
 
 
- gcc doesn't produce better code than it did 25 years go, when it
  was at least an order of magnitude smaller and two orders faster.
  At least not for tightly written programs where the C programmer
  has done optimizing at the source level, so that the compiler has
  little more to think about beyond good instruction selection and
  cleaning up the pessimizations it has itself introduced.

No, gcc produces better code.  Both 25 years ago and now one
can find situations where gcc output could be improved by
rather simple transformations, but it is less frequent now.
Concerning "optimizing at the source level", modern machines
have instructions that can not be directly expressed at
source level, but which can speed up resulting programs.
In particular vector instructions.  Modern gcc is smart enough
to realize that code using separate scalar variables perform
some (not all!) operations in parallel and use vector
instructions.

How much improvement?  Probably in 5-15% range on average
programs for hand-optimized programs.

Concerning size, you are right, there is significant increase in
size.  Concerning speed, that is debatable.  On the same machine
the same somewhat silly file containing just declarations needs
9.894s using gcc-12.2 and 10.668s using gcc-3.4.6.  Different
silly example containg trivial code needs 27.947s using gcc-12.2
and 12.627s using gcc-3.4.6.  Both were at default setting
(no optimization).   As you see, depending on content of the
file gcc-12.2 can be slightly faster or few times slower than
gcc-3.4.6 when doing non-optimizing compilation.

Modern gcc can do whole-program optimization, which can take
a lot more time than function-by-function optimization done
by gcc-3.4.6.  But IME on realistic programs (in particular
split into moderately sized files) optimization increases
time, but that is few times, both for gcc-12.2 and for
older versions.  In other words, typically optimization
does not lead to catastrophic increase in compile time,
both for modern and old gcc.

--
                              Waldek Hebisch

Date Sujet#  Auteur
19 Mar 25 * Suggested method for returning a string from a C program?391DFS
19 Mar 25 +* Re: Suggested method for returning a string from a C program?4Keith Thompson
19 Mar 25 i+- Re: Suggested method for returning a string from a C program?1Keith Thompson
19 Mar 25 i`* Re: Suggested method for returning a string from a C program?2DFS
19 Mar 25 i `- Re: Suggested method for returning a string from a C program?1Keith Thompson
19 Mar 25 +* Re: Suggested method for returning a string from a C program?323Tim Rentsch
19 Mar 25 i+* Re: Suggested method for returning a string from a C program?2DFS
19 Mar 25 ii`- Re: Suggested method for returning a string from a C program?1Richard Heathfield
19 Mar 25 i`* Re: Suggested method for returning a string from a C program?320DFS
19 Mar 25 i +* Re: Suggested method for returning a string from a C program?6Tim Rentsch
19 Mar 25 i i`* Re: Suggested method for returning a string from a C program?5DFS
19 Mar 25 i i +* Re: Suggested method for returning a string from a C program?3James Kuyper
19 Mar 25 i i i+- Re: Suggested method for returning a string from a C program?1Keith Thompson
19 Mar 25 i i i`- Re: Suggested method for returning a string from a C program?1DFS
19 Mar 25 i i `- Re: Suggested method for returning a string from a C program?1Tim Rentsch
19 Mar 25 i `* Re: Suggested method for returning a string from a C program?313Michael S
19 Mar 25 i  +* Re: Suggested method for returning a string from a C program?309DFS
19 Mar 25 i  i`* Re: Suggested method for returning a string from a C program?308Richard Heathfield
19 Mar 25 i  i `* Re: Suggested method for returning a string from a C program?307Michael S
19 Mar 25 i  i  +- Re: Suggested method for returning a string from a C program?1Richard Heathfield
20 Mar 25 i  i  `* Re: Suggested method for returning a string from a C program?305Tim Rentsch
20 Mar 25 i  i   `* Re: Suggested method for returning a string from a C program?304bart
20 Mar 25 i  i    +* Re: Suggested method for returning a string from a C program?298bart
20 Mar 25 i  i    i+* Re: Suggested method for returning a string from a C program?92Muttley
20 Mar 25 i  i    ii+* Re: Suggested method for returning a string from a C program?8Michael S
20 Mar 25 i  i    iii`* Re: Suggested method for returning a string from a C program?7Muttley
20 Mar 25 i  i    iii `* Re: Suggested method for returning a string from a C program?6Michael S
20 Mar 25 i  i    iii  +* Re: Suggested method for returning a string from a C program?3Muttley
23 Mar 25 i  i    iii  i`* Re: Suggested method for returning a string from a C program?2Michael S
23 Mar 25 i  i    iii  i `- Re: Suggested method for returning a string from a C program?1Tim Rentsch
20 Mar 25 i  i    iii  +- Re: Suggested method for returning a string from a C program?1Tim Rentsch
20 Mar 25 i  i    iii  `- Re: Suggested method for returning a string from a C program?1Keith Thompson
20 Mar 25 i  i    ii`* Re: Suggested method for returning a string from a C program?83bart
20 Mar 25 i  i    ii +- Re: Suggested method for returning a string from a C program?1Muttley
20 Mar 25 i  i    ii +* Re: Suggested method for returning a string from a C program?80Michael S
20 Mar 25 i  i    ii i`* Re: Suggested method for returning a string from a C program?79bart
20 Mar 25 i  i    ii i +* Re: Suggested method for returning a string from a C program?3Kaz Kylheku
20 Mar 25 i  i    ii i i`* Re: Suggested method for returning a string from a C program?2Michael S
20 Mar 25 i  i    ii i i `- Re: Suggested method for returning a string from a C program?1Kaz Kylheku
21 Mar 25 i  i    ii i `* Re: Suggested method for returning a string from a C program?75Keith Thompson
24 Mar 25 i  i    ii i  `* The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)74Janis Papanagnou
24 Mar 25 i  i    ii i   `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)73Keith Thompson
25 Mar 25 i  i    ii i    `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)72David Brown
25 Mar 25 i  i    ii i     +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)5Kaz Kylheku
25 Mar 25 i  i    ii i     i`* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)4David Brown
25 Mar 25 i  i    ii i     i `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)3Keith Thompson
26 Mar 25 i  i    ii i     i  +- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Chris M. Thomasson
26 Mar 25 i  i    ii i     i  `- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1David Brown
25 Mar 25 i  i    ii i     +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)64Janis Papanagnou
25 Mar 25 i  i    ii i     i+* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)54bart
25 Mar 25 i  i    ii i     ii`* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)53Janis Papanagnou
26 Mar 25 i  i    ii i     ii +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)2bart
26 Mar 25 i  i    ii i     ii i`- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Janis Papanagnou
26 Mar 25 i  i    ii i     ii `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)50David Brown
26 Mar 25 i  i    ii i     ii  `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)49Janis Papanagnou
26 Mar 25 i  i    ii i     ii   `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)48David Brown
26 Mar 25 i  i    ii i     ii    `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)47Janis Papanagnou
26 Mar 25 i  i    ii i     ii     +- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1David Brown
27 Mar 25 i  i    ii i     ii     `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)45bart
27 Mar 25 i  i    ii i     ii      +- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1bart
27 Mar 25 i  i    ii i     ii      +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)4Waldek Hebisch
27 Mar 25 i  i    ii i     ii      i`* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)3bart
27 Mar 25 i  i    ii i     ii      i +- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1David Brown
28 Mar 25 i  i    ii i     ii      i `- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Waldek Hebisch
27 Mar 25 i  i    ii i     ii      `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)39Janis Papanagnou
27 Mar 25 i  i    ii i     ii       +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)13bart
28 Mar 25 i  i    ii i     ii       i`* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)12Janis Papanagnou
28 Mar 25 i  i    ii i     ii       i +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)9David Brown
28 Mar 25 i  i    ii i     ii       i i+* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)7Janis Papanagnou
28 Mar 25 i  i    ii i     ii       i ii+* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)2Michael S
28 Mar 25 i  i    ii i     ii       i iii`- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Janis Papanagnou
28 Mar 25 i  i    ii i     ii       i ii+* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)2bart
28 Mar 25 i  i    ii i     ii       i iii`- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Janis Papanagnou
28 Mar 25 i  i    ii i     ii       i ii`* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)2David Brown
28 Mar 25 i  i    ii i     ii       i ii `- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Janis Papanagnou
28 Mar 25 i  i    ii i     ii       i i`- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Chris M. Thomasson
28 Mar 25 i  i    ii i     ii       i +- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1bart
31 Mar 25 i  i    ii i     ii       i `- [OT] PC hardware prices [correction] (was Re: The integral type 'byte')1Janis Papanagnou
27 Mar 25 i  i    ii i     ii       `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)25David Brown
28 Mar 25 i  i    ii i     ii        `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)24Janis Papanagnou
28 Mar 25 i  i    ii i     ii         +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)18Chris M. Thomasson
28 Mar 25 i  i    ii i     ii         i`* [OT] SPARC (was Re: The integral type 'byte')17Janis Papanagnou
28 Mar 25 i  i    ii i     ii         i +- Re: [OT] SPARC (was Re: The integral type 'byte')1Keith Thompson
28 Mar 25 i  i    ii i     ii         i +* Re: [OT] SPARC (was Re: The integral type 'byte')14Michael S
28 Mar 25 i  i    ii i     ii         i i+* Re: [OT] SPARC (was Re: The integral type 'byte')8David Brown
28 Mar 25 i  i    ii i     ii         i ii+* Re: [OT] SPARC (was Re: The integral type 'byte')6Michael S
28 Mar 25 i  i    ii i     ii         i iii`* Re: [OT] SPARC (was Re: The integral type 'byte')5David Brown
28 Mar 25 i  i    ii i     ii         i iii +* Re: [OT] SPARC (was Re: The integral type 'byte')3Chris M. Thomasson
28 Mar 25 i  i    ii i     ii         i iii i+- Re: [OT] SPARC (was Re: The integral type 'byte')1Chris M. Thomasson
28 Mar 25 i  i    ii i     ii         i iii i`- Re: [OT] SPARC (was Re: The integral type 'byte')1Kaz Kylheku
28 Mar 25 i  i    ii i     ii         i iii `- Re: [OT] SPARC (was Re: The integral type 'byte')1Kaz Kylheku
28 Mar 25 i  i    ii i     ii         i ii`- Re: [OT] SPARC (was Re: The integral type 'byte')1Kaz Kylheku
28 Mar 25 i  i    ii i     ii         i i`* Re: [OT] SPARC (was Re: The integral type 'byte')5Janis Papanagnou
28 Mar 25 i  i    ii i     ii         i i `* Re: [OT] SPARC (was Re: The integral type 'byte')4Michael S
28 Mar 25 i  i    ii i     ii         i i  +* Re: [OT] SPARC (was Re: The integral type 'byte')2Janis Papanagnou
28 Mar 25 i  i    ii i     ii         i i  i`- Re: [OT] SPARC (was Re: The integral type 'byte')1David Brown
28 Mar 25 i  i    ii i     ii         i i  `- Re: [OT] SPARC (was Re: The integral type 'byte')1Kaz Kylheku
28 Mar 25 i  i    ii i     ii         i `- Re: [OT] SPARC (was Re: The integral type 'byte')1Chris M. Thomasson
28 Mar 25 i  i    ii i     ii         `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)5David Brown
28 Mar 25 i  i    ii i     ii          +- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Michael S
28 Mar 25 i  i    ii i     ii          +* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)2bart
28 Mar 25 i  i    ii i     ii          `- Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)1Janis Papanagnou
26 Mar 25 i  i    ii i     i`* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)9David Brown
25 Mar 25 i  i    ii i     `* Re: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?)2Keith Thompson
20 Mar 25 i  i    ii `- Re: Suggested method for returning a string from a C program?1Keith Thompson
20 Mar 25 i  i    i+* Re: Suggested method for returning a string from a C program?93bart
20 Mar 25 i  i    i+* Re: Suggested method for returning a string from a C program?90Keith Thompson
21 Mar 25 i  i    i`* Re: Suggested method for returning a string from a C program?22Waldek Hebisch
20 Mar 25 i  i    +- Re: Suggested method for returning a string from a C program?1Michael S
20 Mar 25 i  i    +- Re: Suggested method for returning a string from a C program?1Muttley
20 Mar 25 i  i    +- Re: Suggested method for returning a string from a C program?1Kaz Kylheku
20 Mar 25 i  i    +- Re: Suggested method for returning a string from a C program?1Tim Rentsch
20 Mar 25 i  i    `- Re: Suggested method for returning a string from a C program?1Keith Thompson
19 Mar 25 i  `* Re: Suggested method for returning a string from a C program?3Tim Rentsch
19 Mar 25 +* Re: Suggested method for returning a string from a C program?27Keith Thompson
19 Mar 25 +* Re: Suggested method for returning a string from a C program?9Ike Naar
19 Mar 25 +* Re: Suggested method for returning a string from a C program?19bart
19 Mar 25 +* Re: Suggested method for returning a string from a C program?6Michael S
22 Mar 25 `* Re: Suggested method for returning a string from a C program?2Lynn McGuire

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal