Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #120810
| From | Michael S <already5chosen@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: I'm going to give up on this... |
| Date | 2024-10-31 12:44 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <20241031124424.00002cae@yahoo.com> (permalink) |
| References | <vfvlo3$2lbru$1@dont-email.me> |
On Thu, 31 Oct 2024 10:21:54 +0000
Vir Campestris <vir.campestris@invalid.invalid> wrote:
> I have a piece of code that takes a couple of seconds to execute. Or
> perhaps it takes three times longer, depending on a minor change.
>
> The change?
>
> If the function declaration is
> template <typename collection>
> Masker& Masker::andequals(size_t cachesize, collection& primes)
>
> it is fast. But if I tell it what the collection is
> template<>
> Masker& Masker::andequals(size_t cachesize, std::vector<Prime>&
> primes)
>
> It takes three times as long to execute.
>
> But only with g++, and only with -Ofast optimisation. With clang++ I
> see no such effect (it's slow all the time)
>
> WTF?
>
> Andy
In the second case it's no longer a template, right?
So, does it became real function instead of inline?
What if
static inline
Masker& Masker::andequals(
size_t cachesize, std::vector<Prime>& primes) {
}
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I'm going to give up on this... Vir Campestris <vir.campestris@invalid.invalid> - 2024-10-31 10:21 +0000
Re: I'm going to give up on this... Michael S <already5chosen@yahoo.com> - 2024-10-31 12:44 +0200
Re: I'm going to give up on this... Vir Campestris <vir.campestris@invalid.invalid> - 2024-10-31 16:43 +0000
Re: I'm going to give up on this... Mad Hamish <newsunspammelaws@iinet.unspamme.net.au> - 2024-11-03 21:46 +1100
Re: I'm going to give up on this... Vir Campestris <vir.campestris@invalid.invalid> - 2024-11-04 21:30 +0000
Re: I'm going to give up on this... Michael S <already5chosen@yahoo.com> - 2024-11-03 13:41 +0200
Re: I'm going to give up on this... Vir Campestris <vir.campestris@invalid.invalid> - 2024-11-04 21:24 +0000
Re: I'm going to give up on this... Sam <sam@email-scan.com> - 2024-10-31 07:47 -0400
csiph-web