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 BTaskaya
Recipients BTaskaya, eric.smith, pablogsal, rhettinger, serhiy.storchaka
Date 2021-05-23.20:16:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1621800980.77.0.312301916685.issue44194@roundup.psfhosted.org>
In-reply-to
Content
> 1. It can be a str subclass with an overridden __format__. In this case the result will be different.

Thanks! Though this should be possible to do, so not a blocker for suggestion (if I am not missing something)

> 2. If it is a str subclass without an overridden __format__, the optimization adds an overhead for looking up and calling the __format__ method. It can reverse the benefit in this case.

I'll double check, though the compromise seems to make sense considering that %99 of the time this use case is with raw strings.

> 3. It is worth to merge consequent string constants and skip empty string constants. '/'.join([base, 'data', user_arg]) should produce [base, '/data/', user_arg] instead of [base, '/', 'data', '/', user_arg], and ''.join([base, 'data', user_arg]) should produce [base, 'data', user_arg] instead of [base, '', 'data', '', user_arg].

> I believe that the implementation can be optimized further (etc if a continuous block of elements are a string, then we can load all of them in one go!). And some cases proved that the f-strings might be faster than the join by 1.7-1.8x.


I am aware of these possible cases as I stated in the last paragraph, though didn't want to start with them on the PoC. And from what I observe, the speedup goes even further with these.
History
Date User Action Args
2021-05-23 20:16:20BTaskayasetrecipients: + BTaskaya, rhettinger, eric.smith, serhiy.storchaka, pablogsal
2021-05-23 20:16:20BTaskayasetmessageid: <1621800980.77.0.312301916685.issue44194@roundup.psfhosted.org>
2021-05-23 20:16:20BTaskayalinkissue44194 messages
2021-05-23 20:16:20BTaskayacreate