llvm-project/libcxx
Eric Fiselier e782178e9c [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
2015-03-31 16:54:19 +00:00
..
cmake [libcxx] Add code coverage configuration to CMake and LIT. 2015-03-31 04:15:45 +00:00
include [libcxx] Optimize vectors uninitialized construction of trivial types from an iterator range. 2015-03-31 16:54:19 +00:00
lib [libcxx] Add code coverage configuration to CMake and LIT. 2015-03-31 04:15:45 +00:00
src Make the presence of stdin and stdout optional. 2015-03-26 14:35:46 +00:00
test [libcxx] Add code coverage configuration to CMake and LIT. 2015-03-31 04:15:45 +00:00
utils cleanup comments in sym_check 2015-03-27 06:04:37 +00:00
www [libcxx] Unify LIBCXX_<ABI-Name>_INCLUDE_PATHS to be LIBCXX_CXX_ABI_INCLUDE_PATHS 2015-03-19 20:59:45 +00:00
.arcconfig Update Arcanist config to point to reviews.llvm.org 2014-06-10 18:29:36 +00:00
.gitignore [libc++] Refactor test components into modules. 2015-01-09 18:03:29 +00:00
CMakeLists.txt [libcxx] Add code coverage configuration to CMake and LIT. 2015-03-31 04:15:45 +00:00
CREDITS.TXT Add self to CREDITS.txt 2015-02-26 00:48:22 +00:00
LICENSE.TXT Update copyright year to 2015. 2015-03-12 20:13:11 +00:00
Makefile Revert "Fix installheaders target's permissions" 2014-12-16 05:28:07 +00:00