[luatex] fio library byte order

Hans Hagen j.hagen at xs4all.nl
Mon Jun 29 15:35:57 CEST 2020

On 6/29/2020 10:30 AM, Taco Hoekwater wrote:
>> On 28 Jun 2020, at 03:26, Reinhard Kotucha <reinhard.kotucha at web.de> wrote:
>>>> As far as I understand it's sufficient that the relevant
>>>> functions read{cardinal,integer}{2,4} obey a flag which tells
>>>> them whether byte re-ordering is necessary.  The flag has to be
>>>> set if host and file byte orders are different.  I don't know
>>>> whether we have to consider 64 bit integers too.
>>> that adds passing parameters and checking them for each call
>>> ... you can then as well use lua's 'read' function and convert with
>>> string.byte/char which is then about equally fast
>> This is what I actually did.  It took 14 s to process a PNM file, way
>> too much if I have to process hundreds or thousands files.  I ported
>> the script to C and could process the file within 270 ms.  I can't
>> imagine that obeying a variable in C can slow down everything so much.
> The quick way to fix this without noticeable overhead would be to add
> a few extra function definitions for read{cardinal,integer}{2,4} in
> the byte permutations that are likely to actually happen. There are
> not *that* many of those.
that was indeed the idea ... (i'll do it this week)


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the luatex mailing list.