complexity of matching symbol names to version scripts

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 17:26:04 PDT 2016


What I'm worrying is this. Let N be the number of symbols in all input
files and M be the number of symbols that appear in version scripts.

If there's no pattern matching in version symbol script, then the cost of
setting versions is O(M). We call SymbolTable::find(StringRef) for each
symbol from version scripts and set a version to the return value.

But if we allow patterns, the cost becomes O(N). Even though is better than
O(N*M), it is a large number. M is order of hundreds or thousands, but N
can be as large as order of millions.

So I think we should avoid pattern matching to symbols.

On Sat, Apr 30, 2016 at 7:46 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> No idea why this just came to mind, but anyway:
>
> I remember you mentioning that one annoying thing about version
> scripts is the need to match each symbol against multiple possible
> regular expressions (globs?).
>
> But I just remembered that that can be done efficiently. Multiple
> regular expressions can be tested at once. They are all just NFAs :-)
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160502/051c5031/attachment.html>


More information about the llvm-commits mailing list