diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-03-31 16:54:19 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-03-31 16:54:19 +0000 |
commit | e782178e9c647fd923aedeed9f666078ce575fac (patch) | |
tree | 550b73aee8db1a6a129f363327bfbb2d4440c2a6 /clang/lib/Basic/Targets.cpp | |
parent | c351f9563acf9aac0a965b2067b292b550c329b8 (diff) | |
download | bcm5719-llvm-e782178e9c647fd923aedeed9f666078ce575fac.tar.gz bcm5719-llvm-e782178e9c647fd923aedeed9f666078ce575fac.zip |
[libcxx] Optimize vectors uninitialized construction of trivial types from an iterator range.
Summary:
In certain cases vector can use memcpy to construct a range of elements at the back of the vector. We currently don't do this resulting in terrible code gen in non-optimized mode and a
very large slowdown compared to libstdc++.
This patch adds a `__construct_forward_range(Allocator, Iter, Iter, _Ptr&)` and `__construct_forward_range(Allocator, Tp*, Tp*, Tp*&)` functions to `allocator_traits` which act similarly to the existing `__construct_forward(...)` functions.
This patch also changes vectors `__construct_at_end(Iter, Iter)` to be `__construct_at_end(Iter, Iter, SizeType)` where SizeType is the size of the range. `__construct_at_end(Iter, Iter, SizeType)` now calls `allocator_traits<Tp>::__construct_forward_range(...)`.
This patch is based off the design of `__swap_out_circular_buffer(...)` which uses `allocator_traits<Tp>::__construct_forward(...)`.
On my machine this code performs 4x better than the current implementation when tested against `std::vector<int>`.
Reviewers: howard.hinnant, titus, kcc, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D8109
llvm-svn: 233711
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
0 files changed, 0 insertions, 0 deletions