Vector performance improvements: dispatching to memcpy when possible.

[SVN r83271]
This commit is contained in:
Ion Gaztañaga committed 2013-03-03 12:26:48 +00:00
1 parent 9b0a73fc32
commit 6acbbb6f9b
18 files changed
+781 -464

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ rule test_all
for local fileb in [ glob *.cpp ]
{
all_rules += [ run $(fileb) /boost/timer//boost_timer /boost/system//boost_system /boost/thread//boost_thread
all_rules += [ run $(fileb)
: # additional args
: # test-files
: # requirements
+12 -7
View File
@@ -314,15 +314,20 @@ class propagation_test_allocator
friend bool operator!=(const propagation_test_allocator &, const propagation_test_allocator &)
{ return false; }
void swap(propagation_test_allocator &r)
{
++this->swaps_; ++r.swaps_;
boost::container::swap_dispatch(this->id_, r.id_);
boost::container::swap_dispatch(this->ctr_copies_, r.ctr_copies_);
boost::container::swap_dispatch(this->ctr_moves_, r.ctr_moves_);
boost::container::swap_dispatch(this->assign_copies_, r.assign_copies_);
boost::container::swap_dispatch(this->assign_moves_, r.assign_moves_);
boost::container::swap_dispatch(this->swaps_, r.swaps_);
}
friend void swap(propagation_test_allocator &l, propagation_test_allocator &r)
{
++l.swaps_; ++r.swaps_;
container_detail::do_swap(l.id_, r.id_);
container_detail::do_swap(l.ctr_copies_, r.ctr_copies_);
container_detail::do_swap(l.ctr_moves_, r.ctr_moves_);
container_detail::do_swap(l.assign_copies_, r.assign_copies_);
container_detail::do_swap(l.assign_moves_, r.assign_moves_);
container_detail::do_swap(l.swaps_, r.swaps_);
l.swap(r);
}
unsigned int id_;
+3 -3
View File
@@ -112,9 +112,9 @@ class expand_bwd_test_allocator
friend void swap(self_t &alloc1, self_t &alloc2)
{
container_detail::do_swap(alloc1.mp_buffer, alloc2.mp_buffer);
container_detail::do_swap(alloc1.m_size, alloc2.m_size);
container_detail::do_swap(alloc1.m_offset, alloc2.m_offset);
boost::container::swap_dispatch(alloc1.mp_buffer, alloc2.mp_buffer);
boost::container::swap_dispatch(alloc1.m_size, alloc2.m_size);
boost::container::swap_dispatch(alloc1.m_offset, alloc2.m_offset);
}
//Experimental version 2 expand_bwd_test_allocator functions
+1 -1
View File
@@ -133,7 +133,7 @@ class heap_allocator_v1
//!Swap segment manager. Does not throw. If each heap_allocator_v1 is placed in
//!different memory segments, the result is undefined.
friend void swap(self_t &alloc1, self_t &alloc2)
{ detail::do_swap(alloc1.mp_mngr, alloc2.mp_mngr); }
{ boost::container::boost::container::swap_dispatch(alloc1.mp_mngr, alloc2.mp_mngr); }
};
//!Equality test for same type of heap_allocator_v1
+6
View File
@@ -80,6 +80,12 @@ bool vector_copyable_only(V1 *boostvector, V2 *stdvector, boost::container::cont
stdvector->push_back(int(3));
if(!test::CheckEqualContainers(boostvector, stdvector)) return false;
}
{
V1 *pv1 = new V1(*boostvector);
V2 *pv2 = new V2(*stdvector);
delete pv1;
delete pv2;
}
return true;
}