Liste des Groupes | Revenir à cl c |
On 28/05/2024 22:45, Michael S wrote:On Tue, 28 May 2024 23:23:15 +0300
Michael S <already5chosen@yahoo.com> wrote:
>
Also, I think that random numbers are close to worst case for
branch predictor / loop length predictor in my inner loop.
Were I thinking about random case upfront, I'd code an inner loop
differently. I'd always copy 4 octets (comma would be stored in the
same table). After that I would update outptr by length taken from
additional table, similarly, but not identically to your method
below.
That's what I had in mind:
unsigned char bin2dec[256][MAX_CHAR_PER_NUM+1]; //
bin2dec[MAX_CHAR_PER_NUM] => length for (int i = 0; i < 256;++i)
{
Is this a comment that has wrapped?
After fixing a few such line breaks, this runs at 3.6 seconds
compared with 4.1 seconds for the original.
Although I don't quite understand the comments about branch
prediction.
I think runtime is still primarily spent in I/O.
If I take the 1.9 second version, and remove the fwrite, then it runs
in 0.8 seconds. 0.7 of that is generating the text (366MB's worth, a
line at a time).
In my language that part takes 0.9 seconds, which is a more typical
difference due to gcc's superior optimiser.
Les messages affichés proviennent d'usenet.