Liste des Groupes | Revenir à cl c |
On 12/06/2024 23:29, Michael S wrote:Here are some tests embedding a 1.1 MB binary on my machine:On Wed, 12 Jun 2024 15:46:44 +0200I 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.
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.
>
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.
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.
Each individual string is up to 2048 bytes, which can be concatenated to a maximum of 65K in total.That doesn't sound unreasonable.
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.)
Les messages affichés proviennent d'usenet.