r217792 - Teach Clang how to use response files when calling other tools

Reid Kleckner rnk at google.com
Thu Sep 18 16:32:20 PDT 2014


On Thu, Sep 18, 2014 at 4:20 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:
>
> Now, there are 300_000 options in the response file, but adding a
> counter to ] llvm::opt::Option::matches shows that it is called about
> 349_802_000 times :-)
>
> Is this a now issue? Is it worth fixing?
>

It's sort of a known issue, but only by inspection. If you've ever looked
at the driver, there are all these calls to getLastArg(ID), AddAllArgs(ID1,
ID2) and things of that nature. They *all* iterate the whole argument list.

We could probably make this much more efficient by mapping the arguments
into a table indexed by option ID and doing lookup on that. We would still
need to preserve order information, though.

I think when Daniel Dunbar wrote all this, everyone agreed that command
line parsing would never be hot, so it was done expediently and without
consideration for efficiency. Previously strings were not allocated form a
pool, they were merely malloc'd and leaked. The leaks aren't really that
bad, considering that the command line has to live for roughly the driver's
whole life.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140918/919d796a/attachment.html>


More information about the cfe-commits mailing list