hanchenye-llvm-project/libcxx
Howard Hinnant aca09de378 Performance tweaking rotate.
rotate is a critical algorithm because it is often used by other algorithms,
both std and non-std.  The main thrust of this optimization is a specialized
algorithm when the 'distance' to be shifted is 1 (either left or right).  To my
surprise, this 'optimization' was not effective for types like std::string.
std::string favors rotate algorithms which only use swap.  But for types like
scalars, and especially when the sequence is random access, these new
specializations are a big win.  If it is a vector<size_t> for example, the
rotate is done via a memmove and can be several times faster than the gcd
algorithm.

I'm using is_trivially_move_assignable to distinguish between types like int and
types like string.  This is obviously an ad-hoc approximation, but I haven't
found a case where it doesn't give good results.

I've used a 'static if' (with is_trivially_move_assignable) in three places. 
Testing with both -Os and -O3 showed that clang eliminated all code not be
executed by the 'static if' (including the 'static if' itself).

llvm-svn: 161247
2012-08-03 18:01:20 +00:00
..
cmake http://llvm.org/bugs/show_bug.cgi?id=9399 fixed by Ryuta Suzuki 2011-05-24 12:54:00 +00:00
include Performance tweaking rotate. 2012-08-03 18:01:20 +00:00
lib Allow libc++ to be built with CMake from within the LLVM tree. The libc++ part is just some renaming as the variable was already in use, conflicting with something else in the LLVM tree. Contributed by Ruben Van Boxem. 2012-03-19 15:40:23 +00:00
src Andrew Morrow: The attached patch updates the initialization of the 'struct tm' in 2012-08-02 18:44:17 +00:00
test Andrew Morrow: There are two tests under test/utilities/memory that heap allocate two 2012-08-02 18:39:48 +00:00
www Andrew Morrow: Among the various libc++ tests that currently don't pass on Linux are 2012-08-02 18:35:07 +00:00
CMakeLists.txt Fix warning flags for CMake builds, from Andrew C. Morrow! 2012-06-07 22:26:00 +00:00
CREDITS.TXT Update CREDITS.TXT 2012-07-26 20:22:37 +00:00
LICENSE.TXT Happy new year 2012! 2012-01-01 08:16:56 +00:00
Makefile fix help with bash 2012-06-25 23:51:05 +00:00