[squid-dev] Fwd: [PATCH] for loops modernization

Adam Majer amajer at suse.de
Wed Mar 15 14:43:16 UTC 2017


On 03/15/2017 03:17 PM, Amos Jeffries wrote:
> Theoretically range-for loops should allow multi-threaded CPU to run
> those loops a bit faster. If that can be demonstrated using a tool like
> polygraph you have a good argument for a patch containing that change to
> go in as a pure performance change.

No. That would break many many things. There are special directives that
allow this to happen with things like OpenMPI compilers, but that's not
what we are talking about here.

And theoretically, if you blindly allow compilers to optimize loops like
that, you are just as likely to introduce hardware stalls that will
result in slower execution of the overall loop. The only way to look at
these,

    for (TYPE _i : _c )

is syntactic sugar.


Best regards,
- Adam

PS. And if you are talking about vertorization of these loops, that
already happens with regular loops. See,

    https://gcc.gnu.org/projects/tree-ssa/vectorization.html



More information about the squid-dev mailing list