[PATCH] D58296: [llvm-objcopy] Make removeSectionReferences batched
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 20 15:31:01 PST 2019
rupprecht marked 3 inline comments as done.
rupprecht added a comment.
In D58296#1404774 <https://reviews.llvm.org/D58296#1404774>, @jakehehrlich wrote:
> If we're just giving a set we might as well give the user a function instead right? That's a bit more general of an interface and easier to use.
That's a good idea, and makes with experimenting with the lookup algorithm (switching out a vector for an unordered_set) trivial. Done,
> many-sections.o.gz is smaller than 3.3 MB right? I went to a lot of pains to make sure that I was uploading as small a file as was possible. Do we have large file support
>
> cc @echristo who might have a better idea of what our limits are there.
I'll update the patch description -- given concerns about the file size, I'll drop it when committing, but it's here for review if anyone wants to see it.
I could check in a tiny script instead and just generate it on the fly, but that ends up being very slow, so I'd rather check in a pre-built object if anything at all.
================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1358
// an error here instead.
+ std::vector<const SectionBase *> RemoveSections;
+ RemoveSections.reserve(std::distance(Iter, std::end(Sections)));
----------------
jhenderson wrote:
> I'm staring at this and thinking that an unordered Set may be a better container for performance here, especially given our use of pointers, making the comparison and hashing operations cheap. It would remove the need for sort and binary_search in favour of a set lookup, which is (usually) constant time.
>
> Have I missed something?
Switched, although it is only a minor improvement:
python -m timeit -n 3 -r 10 -v -s 'import os' 'os.system("llvm-objcopy -j .keep_me /tmp/huge-input.o /tmp/foo.o")'
w/ sorted vector:
raw times: 4.23 4.14 4.16 4.17 4.27 4.22 4.13 4.14 4.14 4.2
3 loops, best of 10: 1.38 sec per loop
w/ unordered_set:
raw times: 3.83 3.75 3.85 3.77 3.76 3.87 3.81 3.82 3.84 3.83
3 loops, best of 10: 1.25 sec per loop
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58296/new/
https://reviews.llvm.org/D58296
More information about the llvm-commits
mailing list