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 vstinner
Recipients mark.dickinson, rhettinger, serhiy.storchaka, vstinner
Date 2014-05-03.22:41:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwZkwOUmj9dS4qmeQgz=m-XtKeFJe4fQgsiFW8+cCHUkZg@mail.gmail.com>
In-reply-to <1399155359.71.0.292905309603.issue21422@psf.upfronthosting.co.za>
Content
> I would think that in real-world code, this branch will almost never be
taken.  The common case will pay a price (albiet a small one) for almost
zero benefit.

I think that x << 0 is common even if it's not written like that (it's more
for i in range(8): ... x << i).

The benefit is to reduce the memory footprint.

Can you sow the overhead of the branch in a microbenchmark? The test is
only done once, it's out of a loop.

*If* it's possible to notice an overhead, we can maybe use GCC macro
unlikely().
History
Date User Action Args
2014-05-03 22:41:29vstinnersetrecipients: + vstinner, rhettinger, mark.dickinson, serhiy.storchaka
2014-05-03 22:41:29vstinnerlinkissue21422 messages
2014-05-03 22:41:29vstinnercreate