[cfe-dev] missing optimization opportunity for const std::vector compared to std::array
Dennis Luehring
dl.soluz at gmx.net
Wed Jun 4 21:44:24 PDT 2014
Am 04.06.2014 21:03, schrieb Richard Smith:
> > #include <string>
> > int main()
> > {
> > return std::string("hello").size();
> > }
> >
> > results in:
>
>
> main: # @main
> movl $5, %eax
> retq
>
> > and
> >
> > #include <vector>
> > #include <numeric>
> >
> >
> > typedef std::vector<int> container_t;
> >
> > int main()
> > {
> >
> > const container_t a{1,2};
> > const container_t b{4,5};
> > const container_t ints
> > {
> > std::accumulate(a.begin(),a.end(),1),
> > std::accumulate(b.begin(),b.end(),2),
> > };
> > return std::accumulate(ints.begin(),ints.end(),100);
> > }
> >
> > results in:
> >
>
> main: # @main
> movl $115, %eax
> retq
>
so the introduction of
void *__builtin_operator_new(size_t)
void __builtin_operator_delete(void*)
in clang and your patching of libc++ reduces my testszenarios results
down to the absolutely bare minimum
it can't get better - thank you very much
its a ~small~ optimization - but i think the impact could be very huge
for libc++ using code bases
can you post the patch/review link?
are there still known corner cases / similar examples that do not profit
from your patch?
dennis
More information about the cfe-dev
mailing list