This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Reserve memory before pushing back
ClosedPublic

Authored by gAlfonso-bit on Dec 6 2022, 4:04 PM.

Details

Summary

It is generally good practice, if you know how big the vector is going to be in the end, to reserve before continually calling "push_back" or "emplace_back"

Diff Detail

Event Timeline

gAlfonso-bit created this revision.Dec 6 2022, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 4:04 PM
gAlfonso-bit requested review of this revision.Dec 6 2022, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 4:04 PM
MaskRay accepted this revision.Dec 6 2022, 4:07 PM
This revision is now accepted and ready to land.Dec 6 2022, 4:07 PM
MaskRay added inline comments.Dec 6 2022, 4:30 PM
llvm/tools/llvm-cov/CoverageReport.cpp
406

Drop unneeded change

442

wrong indentation

Resolved changes

gAlfonso-bit marked 2 inline comments as done.Dec 6 2022, 4:34 PM
gAlfonso-bit retitled this revision from Reserve memory before pushing back to [LLVM] Reserve memory before pushing back.Dec 7 2022, 2:51 PM
MaskRay retitled this revision from [LLVM] Reserve memory before pushing back to [llvm] Reserve memory before pushing back.Dec 8 2022, 12:38 AM
This revision was automatically updated to reflect the committed changes.