This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Kojoley
Recipients Kojoley, rhettinger, serhiy.storchaka, vstinner
Date 2017-03-02.17:28:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488475697.8.0.935554655235.issue29698@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2017-03-02 17:28:17Kojoleysetrecipients: + Kojoley, rhettinger, vstinner, serhiy.storchaka
2017-03-02 17:28:17Kojoleysetmessageid: <1488475697.8.0.935554655235.issue29698@psf.upfronthosting.co.za>
2017-03-02 17:28:17Kojoleylinkissue29698 messages
2017-03-02 17:28:17Kojoleycreate