lua-users home
lua-l archive

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


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).

--Mike