This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] : Add move symantics to more of libstdc++


Paolo Carlini wrote:

chris jefferson wrote:



This patch makes remove, remove_if, rotate and the heap functions move
aware. It also tidies up some swaps to iter_swap, and adds a test case
or two and a couple of testcases fixes. Has been carefully designed so
that it will have no effect on the performance of non move-aware types
(in particular the built in types).

This patch does do a number of small things at the same time, if you'd
like it splitting into patches which each only do one thing, I'll do that.



I think it's rather understandable as-is, thanks. I'm going to look into it, regtest again on my side, and so on. I'll let you know how it goes and in case everything is ok, we can go ahead, as usual.

Two quick comments:
1- ALISING should be intended as ALIASING, right?


Yup :)

2- I have a rough list of algorithms which can internally exploit
efficient moves (courtesy of Howard Hinnant ;). I would guess the same
is true for our simulated move-semantics, as far as containers of
containers are concerned:
- remove
- unique (done!)
- rotate (done!)
- sort
- stable-sort
- heap-sort
- partition (done!)



I've been checking with my own work against n1771, which lists the suggested requirements for each algorithm. I agree with them :)

Partition in fact only uses swap, so it was already optimised. Remove is also done with this new submission, as is heap sort. The main work left revolves around the merging and sorting algorithms, which all use each other and the same set of internal algorithms . This requires a) move-aware allocators (which aren't actually very hard) and figuring out how to change __unguarded_partition without causing a loss of efficency for other types.

Once this is done (and in particular the move-aware allocators), then it should be easy to also fix the containers themselves (ie reallocating deque and vector).

Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]