Re: Baby X is bor nagain

Liste des GroupesRevenir à cl c  
Sujet : Re: Baby X is bor nagain
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.c
Date : 13. Jun 2024, 14:46:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4et7o$29ejt$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 13/06/2024 12:53, David Brown wrote:
On 12/06/2024 23:29, Michael S wrote:
On Wed, 12 Jun 2024 15:46:44 +0200
David Brown <david.brown@hesbynett.no> wrote:
>
>
I also don't imagine that string literals would be much faster for
compilation, at least for file sizes that I think make sense.
>
Just shows how little do you know about internals of typical compiler.
Which, by itself, is o.k. What is not o.k. is that with your level of
knowledge you have a nerve to argue vs bart that obviously knows a lot
more.
>
 I know more than most C programmers about how certain C compilers work, and what works well with them, and what is relevant for them - though I certainly don't claim to know everything.  Obviously Bart knows vastly more about how /his/ compiler works.  He also tends to do testing with several small and odd C compilers, which can give interesting results even though they are of little practical relevance for real-world C development work.
 Testing a 1 MB file of random data, gcc -O2 took less than a second to compile it.  One megabyte is about the biggest size I would think makes sense to embed directly in C code unless you are doing something very niche - usually if you need that much data, you'd be better off with separate files and standardised packaging systems like zip files, installer setup.exe builds, or that kind of thing.
Here are some tests embedding a 1.1 MB binary on my machine:
                      Numbers        One string
   gcc 14.1 -O0       3.2 (0.2)      0.4 (0.2)     Seconds
   tcc                0.4 (0.03)     0.07 (0.03)
Using 'One string' makes gcc as fast as Tiny C working with 'Numbers'!
The figures in brackets are the build times for hello.c, to better appreciate the differences.
Including those overheads, 'One string' makes gcc 8 times as fast as with 'Numbers'. Excluded those overheads, and it is 15 times as fast (3.0 vs 0.2).
For comparions, here is the timing for my non-C compiler using direct embedding:
   mm                 0.05 (0.03)
The extra time compared with 'hello' is 20ms; tcc was 370/40ms, and gcc was 3000/200ms.

Using string literals, the compile time was shorter, but when you are already below a second, it's all just irrelevant noise.
My machine is slower than yours. It's not anyway just about one machine and one program. You're choosing to spend 10 times as long to do a task, using resources that could be used for other processes, and using extra power.
But if you are creating a tool for N other people to use who may be running it M times a day on data of size X, you can't just dismiss these considerations. You don't know how far people will push the operating limits of your tool.

Each individual string is up to 2048 bytes, which can be concatenated to a maximum of 65K in total.
 I see other links giving different values, but I expect the MS ones to be authoritative.  It is possible that newer versions of their C compiler have removed the limit, just as for their C++ compiler, but it was missing from that webpage.
 (And I noticed also someone saying that MSVC is 70x faster at using string literals compared to lists of integers for array initialisation.)
That doesn't sound unreasonable.
Note that it is not necessary to use one giant string; you can chop it up into smaller strings, say with one line's worth of values per string, and still get most of the benefits. It's just a tiny bit more fiddly to generate the strings.
Within my compiler, each single number takes a 64-byte record to represent. So 1MB of data takes 64MB, while a 1MB string takes one 64-byte record plus the 1MB of the string data.
Then there are the various type analysis and other passes that have to be done a million times rather then once. I'd imagine that compilers like gcc do a lot more.

Date Sujet#  Auteur
12 Jun 24 * Re: Baby X is bor nagain314Bonita Montero
12 Jun 24 +* Re: Baby X is bor nagain311David Brown
12 Jun 24 i+* Re: Baby X is bor nagain2Malcolm McLean
12 Jun 24 ii`- Re: Baby X is bor nagain1David Brown
12 Jun 24 i+- Re: Baby X is bor nagain1Bonita Montero
12 Jun 24 i`* Re: Baby X is bor nagain307bart
12 Jun 24 i +* Re: Baby X is bor nagain4Bonita Montero
12 Jun 24 i i`* Re: Baby X is bor nagain3bart
12 Jun 24 i i `* Re: Baby X is bor nagain2Bonita Montero
12 Jun 24 i i  `- Re: Baby X is bor nagain1bart
12 Jun 24 i `* Re: Baby X is bor nagain302David Brown
12 Jun 24 i  `* Re: Baby X is bor nagain301Michael S
12 Jun 24 i   +- Re: Baby X is bor nagain1Malcolm McLean
13 Jun 24 i   `* Re: Baby X is bor nagain299David Brown
13 Jun 24 i    +* Re: Baby X is bor nagain5bart
13 Jun 24 i    i+* Re: Baby X is bor nagain3tTh
13 Jun 24 i    ii`* Re: Baby X is bor nagain2bart
14 Jun 24 i    ii `- Re: Baby X is bor nagain1Bonita Montero
13 Jun 24 i    i`- Re: Baby X is bor nagain1Michael S
13 Jun 24 i    `* Re: Baby X is bor nagain293Michael S
14 Jun 24 i     +* Re: Baby X is bor nagain3David Brown
14 Jun 24 i     i`* Re: Baby X is bor nagain2bart
15 Jun 24 i     i `- Re: Baby X is bor nagain1David Brown
17 Jun 24 i     `* Re: Baby X is bor nagain289James Kuyper
17 Jun 24 i      +* Re: Baby X is bor nagain86Kaz Kylheku
17 Jun 24 i      i+- Are Javascript and Python similarly slow ? (Was: Baby X is bor nagain)1Michael S
17 Jun 24 i      i+* Re: Baby X is bor nagain2Michael S
18 Jun 24 i      ii`- Re: Baby X is bor nagain1Tim Rentsch
17 Jun 24 i      i+* Re: Baby X is bor nagain80David Brown
18 Jun 24 i      ii`* Re: Baby X is bor nagain79Michael S
18 Jun 24 i      ii `* Re: Baby X is bor nagain78David Brown
18 Jun 24 i      ii  +* Re: Baby X is bor nagain7bart
18 Jun 24 i      ii  i`* Re: Baby X is bor nagain6David Brown
18 Jun 24 i      ii  i +* Re: Baby X is bor nagain2bart
18 Jun 24 i      ii  i i`- Re: Baby X is bor nagain1David Brown
18 Jun 24 i      ii  i `* Re: Baby X is bor nagain3DFS
18 Jun 24 i      ii  i  `* Re: Baby X is bor nagain2Mark Bourne
18 Jun 24 i      ii  i   `- Re: Baby X is bor nagain1DFS
18 Jun 24 i      ii  +* Re: Baby X is bor nagain3Malcolm McLean
18 Jun 24 i      ii  i+- Re: Baby X is bor nagain1David Brown
18 Jun 24 i      ii  i`- Re: Baby X is bor nagain1Mark Bourne
18 Jun 24 i      ii  `* Re: Baby X is bor nagain67Michael S
18 Jun 24 i      ii   +* Re: Baby X is bor nagain65Malcolm McLean
18 Jun 24 i      ii   i+* Re: Baby X is bor nagain59Keith Thompson
19 Jun 24 i      ii   ii`* Re: Baby X is bor nagain58Malcolm McLean
19 Jun 24 i      ii   ii +* Re: Baby X is bor nagain56David Brown
19 Jun 24 i      ii   ii i`* Re: Baby X is bor nagain55Malcolm McLean
19 Jun 24 i      ii   ii i `* Re: Baby X is bor nagain54David Brown
19 Jun 24 i      ii   ii i  `* Re: Baby X is bor nagain53Malcolm McLean
19 Jun 24 i      ii   ii i   +* Re: Baby X is bor nagain10bart
20 Jun 24 i      ii   ii i   i`* Re: Baby X is bor nagain9David Brown
20 Jun 24 i      ii   ii i   i `* Re: Baby X is bor nagain8bart
20 Jun 24 i      ii   ii i   i  `* Re: Baby X is bor nagain7David Brown
20 Jun 24 i      ii   ii i   i   `* Re: Baby X is bor nagain6bart
20 Jun 24 i      ii   ii i   i    +* Re: Baby X is bor nagain2Michael S
20 Jun 24 i      ii   ii i   i    i`- Re: Baby X is bor nagain1bart
20 Jun 24 i      ii   ii i   i    `* Re: Baby X is bor nagain3David Brown
20 Jun 24 i      ii   ii i   i     `* Re: Baby X is bor nagain2bart
21 Jun 24 i      ii   ii i   i      `- Re: Baby X is bor nagain1David Brown
20 Jun 24 i      ii   ii i   `* Re: Baby X is bor nagain42David Brown
20 Jun 24 i      ii   ii i    `* Re: Baby X is bor nagain41Malcolm McLean
20 Jun 24 i      ii   ii i     +- Re: Baby X is bor nagain1David Brown
20 Jun 24 i      ii   ii i     `* Re: Baby X is bor nagain39Ben Bacarisse
20 Jun 24 i      ii   ii i      +* Re: Baby X is bor nagain2Malcolm McLean
20 Jun 24 i      ii   ii i      i`- Re: Baby X is bor nagain1Ben Bacarisse
20 Jun 24 i      ii   ii i      +* Re: Baby X is bor nagain9Tim Rentsch
20 Jun 24 i      ii   ii i      i`* Re: Baby X is bor nagain8Malcolm McLean
20 Jun 24 i      ii   ii i      i +* Re: Baby X is bor nagain2James Kuyper
20 Jun 24 i      ii   ii i      i i`- Re: Baby X is bor nagain1Keith Thompson
20 Jun 24 i      ii   ii i      i +- Re: Baby X is bor nagain1Vir Campestris
20 Jun 24 i      ii   ii i      i +* Re: Baby X is bor nagain2Keith Thompson
20 Jun 24 i      ii   ii i      i i`- Re: Baby X is bor nagain1vallor
21 Jun 24 i      ii   ii i      i +- Re: Baby X is bor nagain1Tim Rentsch
21 Jun 24 i      ii   ii i      i `- Re: Baby X is bor nagain1David Brown
20 Jun 24 i      ii   ii i      `* Re: Baby X is bor nagain27Keith Thompson
20 Jun 24 i      ii   ii i       `* Re: Baby X is bor nagain26Ben Bacarisse
20 Jun 24 i      ii   ii i        +* Re: Baby X is bor nagain2Michael S
21 Jun 24 i      ii   ii i        i`- Re: Baby X is bor nagain1Ben Bacarisse
20 Jun 24 i      ii   ii i        +- Re: Baby X is bor nagain1Keith Thompson
21 Jun 24 i      ii   ii i        +* Re: Baby X is bor nagain2James Kuyper
21 Jun 24 i      ii   ii i        i`- Re: Baby X is bor nagain1Keith Thompson
22 Jun 24 i      ii   ii i        `* Re: Baby X is bor nagain20Tim Rentsch
23 Jun 24 i      ii   ii i         `* Re: Baby X is bor nagain19Ben Bacarisse
23 Jun 24 i      ii   ii i          +* Re: Baby X is bor nagain9James Kuyper
23 Jun 24 i      ii   ii i          i`* Re: Baby X is bor nagain8Tim Rentsch
23 Jun 24 i      ii   ii i          i +* Re: Baby X is bor nagain4Ben Bacarisse
24 Jun 24 i      ii   ii i          i i`* Re: Baby X is bor nagain3Tim Rentsch
25 Jun 24 i      ii   ii i          i i `* Re: Baby X is bor nagain2Ben Bacarisse
25 Jun 24 i      ii   ii i          i i  `- Re: Baby X is bor nagain1Tim Rentsch
24 Jun 24 i      ii   ii i          i `* Re: Baby X is bor nagain3Keith Thompson
24 Jun 24 i      ii   ii i          i  `* Re: Baby X is bor nagain2Tim Rentsch
24 Jun 24 i      ii   ii i          i   `- Re: Baby X is bor nagain1Keith Thompson
23 Jun 24 i      ii   ii i          `* Re: Baby X is bor nagain9Tim Rentsch
23 Jun 24 i      ii   ii i           +* Re: Baby X is bor nagain2Malcolm McLean
24 Jun 24 i      ii   ii i           i`- Re: Baby X is bor nagain1Tim Rentsch
23 Jun 24 i      ii   ii i           `* Re: Baby X is bor nagain6Ben Bacarisse
24 Jun 24 i      ii   ii i            `* Re: Baby X is bor nagain5Tim Rentsch
25 Jun 24 i      ii   ii i             `* Re: Baby X is bor nagain4Ben Bacarisse
26 Jun 24 i      ii   ii i              `* Re: Baby X is bor nagain3Tim Rentsch
26 Jun 24 i      ii   ii i               `* Re: Baby X is bor nagain2Ben Bacarisse
27 Jun 24 i      ii   ii i                `- Re: Baby X is bor nagain1Tim Rentsch
19 Jun 24 i      ii   ii `- Re: Baby X is bor nagain1Keith Thompson
19 Jun 24 i      ii   i`* Re: Baby X is bor nagain5David Brown
19 Jun 24 i      ii   `- Re: Baby X is bor nagain1David Brown
18 Jun 24 i      i+- Re: Baby X is bor nagain1James Kuyper
20 Jun 24 i      i`- Re: Baby X is bor nagain1Vir Campestris
17 Jun 24 i      +* Re: Baby X is bor nagain199bart
17 Jun 24 i      `* Re: Baby X is bor nagain3Malcolm McLean
12 Jun 24 `* Topicality is not your strong suit (Was: Baby X is bor nagain)2Kenny McCormack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal