2009/12/2 Taco Hoekwater
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.
Ah, in that case I will stick with the procedural interface, indeed. Database loading makes for the most of the start-up time in my tests and the invoked standalone script has to make its own call to kpse.set_program_name anyway. Thanks for all this info. Cheers, Tomek