[Dev-luatex] procedural vs. object interface to kpathsea
Taco Hoekwater
taco at elvenkind.com
Wed Dec 2 13:31:12 CET 2009
Hi,
T T wrote:
>
>> Whether the distinction matters to you depends on what you want
>> to do.
>
> I'm working on a script wrapper for TL that runs under texlua. As an
> optimization I want to call (tex)lua scripts directly with dofile to
> avoid spawning new processes, but I want to make sure that
> kpse.set_program_name from my wrapper doesn't impact the invoked
> script in any way.
>
> As I understand in this scenario it will be better to use kpse object
> and keep it local.
Probably, but:
> Does this incur any performance penalty, i.e. does
> kpathsea reinitializes itself from scratch when my object goes out of
> scope and set_program_name is called again?
When a kpse:new() variable goes out of scope or when you want to change
its program name you will have to start a brand new one.
If you use the procedural interface, kpse.set_program_name() will
keep its cnf and databases files in memory, only the rest is reset.
This kpathsea never goes out of scope, because it is a global luatex
variable.
So, for efficiency reasons, you could opt to only reset the program_name
via the procedural interface, unless the script updates the database
and/or cnf file.
Best wishes,
Taco
More information about the dev-luatex
mailing list