<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Le 3 août 2021 à 09:09, Hans Hagen <<a href="mailto:j.hagen@xs4all.nl" class="">j.hagen@xs4all.nl</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">On 8/2/2021 9:37 PM, jfbu wrote:<br class=""><blockquote type="cite" class="">forgot to mention that I am aware a \fontdimen is limited to 2**30 strictly anyhow<br class="">but my question is whether such « arrays » are stored 32bits or 64bits itemwise<br class=""></blockquote>it happens to be an array of 32 bit integers (that grows on demand) but such implementaiton details are unspecified (could as well have been a sparse array in which case each entry that is actually set has more<br class=""><br class="">also, the fact that it grow is a sort of side effect of the fact that tfm fonts can have 7 or more, but 7 are used, for text upto more for math fonts<br class=""><br class="">so, i wouldn't rely on these properties too much<br class=""></div></div></blockquote><div><br class=""></div>Thanks! </div><div><br class=""></div><div>Reason I asked is because I contributed an Eratosthenes Prime sieve to a github site comparing a whole bunch of langages and it is asked there to specify whether the « arrays » use 1bit, 8bits, 32bits, or 64bits (or « unknown ») per (potential) prime.</div><div><br class=""></div><div><a href="https://github.com/PlummersSoftwareLLC/Primes/blob/drag-race/CONTRIBUTING.md#flag-storage" class="">https://github.com/PlummersSoftwareLLC/Primes/blob/drag-race/CONTRIBUTING.md#flag-storage</a></div><div><br class=""></div><div>I am using luatex for the benchmark because even setting pdftex’s font_mem_size at its maximum TeXLive setting, the memory is at risk of being exhausted on current personal computers  from the condition that the benchmark must iterate at least until a duration of 5 seconds and each iteration re-in allocates a \fontdimen « array » (in the case at hand about 500,000 entries are needed to sieve up to 1,000,000 and memory will get exhausted before the 300th pass)</div><div><br class=""></div><div>Also it seems luatex runs comparatively faster once the sieving range is large enough (the instantiation step which requires extending dynamically does take some time).</div><div><br class=""></div><div>I will thus modify the « bit count » tag of my « solution » from unknown to 32bits, thanks to your answer, knowing though that this remains officially unspecified. But the Dockerfile which I was asked to include, and which their benchmarking uses, pulls a texlive-minimal based image dating back to 2018.</div><div><br class=""></div><div>Perhaps someone here will be interested into contributing a genuine luatex (i.e. using Lua) solution (my code uses only Knuth TeX; there is also a LaTeX3 code also on the github site).</div><div><br class=""></div><div>There is already at least one Lua contribution. I don’t know if a genuine luatex would have to be categorized under « PrimeTeX » or « PrimeLua » ...</div><div><br class=""></div><div>... in particular a LuaTeX genuine solution may have a way to use an « array » not based on font dimension parameters.</div><div><br class=""></div><div>One particular point I don’t know is whether LuaTeX would allow a « faithful » solution: this seems to mean roughly a class-encapsulated one (it is hard to understand what they precisely mean in their guidelines), which I could not really emulate in my code due to global nature of fontdimen assignments.</div><div><br class=""></div><div>(I also experimented with  a csname based approach but never could reach comparable speed to fontdimen arrays ; and this required extending other parts of the memory)</div><div><br class=""></div><div>Here is a link to how the various implementations sort out currently on one specific machine:</div><div><br class=""></div><div><a href="https://plummerssoftwarellc.github.io/PrimeView/?sc=dt&sd=True&rc=30" class="">https://plummerssoftwarellc.github.io/PrimeView/?sc=dt&sd=True&rc=30</a></div><div><br class=""></div><div><br class=""></div><div>Thanks,</div><div><br class=""></div><div>Jean-François</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Hans</div></div></blockquote></div></body></html>