···<date: 2013-11-09, Saturday>···<from: Hans Hagen>···
> On 11/9/2013 6:45 PM, Philipp Gesang wrote: > > Hi all, > > > > calling fontloader.to_table() appears to be redundant when > > extracting font names, see the attached patch. On my system I > > measured 42 (patched) vs 59 (vanilla) seconds for rebuilding the > > entire index: > > > > mtxrun --script fonts --reload --force > > > > The resulting index is -- except for the uuid, naturally -- > > identical in both cases. > > Okay. > > In fact this fullinfo was meant as temporary hack because > fontloader.info should return these values (and might at some time). > > In the meantime delayed loading was introduced which is why: > > function fontloader.fullinfo(...) -- lazy loading anyway > local ff = fontloader.open(...) > if ff then > return ff > else > return nil, "error in loading font" > end > end > > also could work ok (in fact, the explicit glyphs = nil in the current > variant assumes the old loader and has the speed impact you notice > because it now first loads all glyphs and next discards them) > > Okay, in practice we need something like this: > > function fontloader.fullinfo(...) -- lazy loading anyway > local ff = fontloader.open(...) > if ff then > local d = { } -- ff is userdata so [1] or # fails on it > setmetatable(d, { __index = ff }) > return d > else > return nil, "error in loading font" > end > end Aren’t you allocating fonts without freeing them? With this approach you need fontloader.close() somewhere inside check_names() which isn’t straightforward if you hide the font data inside the metatable. Btw. calling fontloader.info() first yields a table for ttcs and is unnoticable performance-wise. Best, Philipp
pgpDLLknNrBhp.pgp
Description: PGP signature
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________