Terry J. Reedy <[EMAIL PROTECTED]> added the comment:

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.

----------
nosy: +tjreedy

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3459>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to