Nikita Kniazev added the comment:

> The purpose of the issue is unclear to me.

I was asked to open an issue by Serhiy Storchaka on the GitHub PR.

> Why do you want to replace while with for? For readability?

Yes, I have open a PR just to improve the readability, because I was surprised 
by this incrementing-decrementing statements like you.

> You should ask Raymond Hettinger for the rationale. The commit message says 
> "better generated code (on both GCC and CLang)", but there is no benchmark 
> nor any data to validate this.

The purpose is clear to me - to eliminate postincrement and temporary variable 
that it requires.

> Nowadays, C compilers are very smart and implement crazy optimizations. 
> Python releases are compiled using PGO, or even PGO+LTO. Please compile your 
> benchmark using PGO. I expect that compilers emit the same machine code at 
> the end for "while" and "for" loops.
> The question is also if your benchmark is revelant for the _collections 
> module.
> What should I see in your benchmark? I see that results are the same for 
> while and for_loop except a minor noise in the benchmark.

Benchmark was made to show that location of cmp+jmp location (look at asm 
output for more info) makes no sense to performance.
Actually I do not want to spend more time on a such minor change.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29698>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to