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 terry.reedy
Recipients loewis, pitrou, rhettinger, terry.reedy
Date 2008-08-01.23:20:50
SpamBayes Score 0.032817934
Marked as misclassified No
Message-id <1217632851.72.0.253332599253.issue3459@psf.upfronthosting.co.za>
In-reply-to
Content
How much does the optimization speed up (or slow down?) a more normal
case when it is applicable?
  bl = [b'', b'a']

How much does the optimization slow down the normal case where it is not
applied?
  bl = [b'a']*2
  bl = [b'a']*10000

Could not the .join user simply not add empty list items?

Looking at the code, there appear to be 4 extra operations for every
item in the normal case: assign item_size, test item_size, assign
nonempty, increment nb_nonempty.  I believe this alternative might be
generally faster.  Before the normal scan,

if seplen == 0:
  for item in seq:
    <if second non-null item>: break
  else:
    <do shortcut and return>

<do normal process>

Then normal cases will bail out on the second item and continue without
further impact.
History
Date User Action Args
2008-08-01 23:20:51terry.reedysetrecipients: + terry.reedy, loewis, rhettinger, pitrou
2008-08-01 23:20:51terry.reedysetmessageid: <1217632851.72.0.253332599253.issue3459@psf.upfronthosting.co.za>
2008-08-01 23:20:51terry.reedylinkissue3459 messages
2008-08-01 23:20:50terry.reedycreate