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 kj
Recipients eric.smith, josh.r, kj, samuelmarks
Date 2020-12-21.03:50:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608522630.73.0.842939124155.issue42699@roundup.psfhosted.org>
In-reply-to
Content
Sorry for intruding, but I thought I'd offer some rudimentary, non-scientific benchmarks for this:

[MSC v.1928 32 bit (Intel)] on win32  # a debug build of python, no compiler optimizations

import timeit
# gen comp
timeit.timeit("''.join(str(_) for _ in range(1000))", number=10000)
11.154560299999957

# list comp
timeit.timeit("''.join([str(_) for _ in range(1000)])", number=10000)
9.987510899999961

The list comp is slightly faster than the gen comp. Interestingly, if one were to use python -m timeit instead, the gen comp would show better results since it has a better 'best of 5' timing. IMO, total time is a more accurate representation than best of 5 since the latter gets skewed by outliers.
History
Date User Action Args
2020-12-21 03:50:30kjsetrecipients: + kj, eric.smith, josh.r, samuelmarks
2020-12-21 03:50:30kjsetmessageid: <1608522630.73.0.842939124155.issue42699@roundup.psfhosted.org>
2020-12-21 03:50:30kjlinkissue42699 messages
2020-12-21 03:50:30kjcreate