On Tue Jul 20, 2021 at 7:56 PM CEST, Taco Hoekwater wrote:
Hi,
On 20 Jul 2021, at 18:01, Michal Vlasák
wrote: Hello,
when NO_DUMP_SHARE is not defined and the system is Little endian, then for the possibility of sharing format files between architectures all dumped multi-byte valules are byte swapped by the function "swap_items" in "tex/texfileio.c".
The origin of the function is in Web2C's "texmfmp.c" and it seems that it was added to LuaTeX in the version 1.08 when the source was converted from CWeb (or am I reading the history wrong?).
That code has been around since 2010 (luatex 0.60-ish). I can’t remember exactly why I did that odd copying to a temp array, but I do remember that that particular function was quite problematic w.r.t. endianness and (cross)compiler issues (read: bugs, as in “internal compiler error").
Thank you for your valuable insight Taco. My thinking was skewed because I read the history incorrectly, thinking it was more of a mistake that slipped into a big commit. Anyways despite the number of allocations the performance is probably fine, since nobody complained, yet. I noticed it by chance while reading the code. Best regards, Michal Vlasák