This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Avoids std::distance calls
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 4 Jun 2018 22:09:12 +0100
- Subject: Re: Avoids std::distance calls
- References: <8c9ec4bd-c2d2-a81b-52ee-7141465e32df@gmail.com>
On 04/06/18 22:13 +0200, François Dumont wrote:
Hi
I'd like to propose this patch to avoid std::distance calls. In a
number of situation in algos we already have the size of the buffer we
need so we shouldn't have to compute it again.
Just one place, in __inplace_merge, no?
I don't think there is any abi concern for this inline constructor,
isn't there ?
No concerns, users can't explicitly instantiate that type, and it will
be inlined or generate an instantiation everywhere it's used.
* include/bits/stl_tempbuf.h
(_Temporary_buffer(_FwdIte, _FwdIte)): Delete, replaced by...
(_Temporary_buffer(_FwdIte, size_type)): ...this, new.
* include/ext/memory (temporary_buffer<>(_FwdIte, _FwdIte)): Adapt.
* include/bits/stl_algo.h (__stable_partition): Adapt.
(__inplace_merge): Adapt.
(__stable_sort): Adapt.
Tested under Linux x86_64 normal mode.
Ok to commit ?
OK, thanks.