Sujet : Re: Baby X is bor nagain
De : bc (at) *nospam* freeuk.com (bart)
Groupes : comp.lang.cDate : 11. Jun 2024, 20:31:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4a8nc$16vef$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 11/06/2024 19:22, Bonita Montero wrote:
Am 11.06.2024 um 19:09 schrieb bart:
A char array initialised a byte at a time?
That is going to be inefficient.
xxd does is that way.
Which option is that?
All recent discussions of xxd have used the '-i' option which writes out the data as individual hex bytes such as '0x41,'.
The most compact option appears to be '-ps', but that is not a C data format.
Or do you mean that xxd does a byte at a time, and so your version did the same?
In that case don't be afraid to do your own thing if it is better.
I've just done a test. First writing a 5MB binary as 5 million individual bytes, one per line. Compiling that with gcc took 15 seconds.
Then I wrote it as a single string full of hex codes as I suggested.
Now compilation took 1.3 seconds.
Using Tiny C, compile time reduced from 1.75 seconds to under 0.3 seconds. 12 times or 6 times faster compile-time; string data is always faster.