lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jul 11, 2011 at 22:09, Mike Pall <mikelu-1107@mike.de> wrote:
> Alexander Gladysh wrote:
>> If, say, I have a long list of paths (like tens) and an equal
>> probability to find the file in any of them, how lots of failed
>> ffi.load()s will affect the performance? (Sorry for being too sleepy
>> to write a benchmark myself.)

> If dlopen() can't open a file, it'll error out quickly. The main
> overhead is mapping a library into memory, resolving the
> relocations, looking up the symbols and so on. But that happens
> only on success.

> But why are you worried at all? If you repeatedly need to load
> hundreds of different libraries, then you have a serious design
> problem, anyway. Ditto if you're not caching the library
> namespaces (no need to cache individual symbols, though).

Well, startup times are sometimes critical as well... The worry is
purely theoretical though. Given a package.searchpath() implementation
(which, after all, I'm able to write myself if I have to) I will be
able to do the lookup I need.

Thanks,
Alexander.