Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PR #8535/7108d646 backport][3.10] Small speed up to cookiejar filter…
…_cookies (#8537) **This is a backport of PR #8535 as merged into master (7108d64).** <!-- Thank you for your contribution! --> ## What do these changes do? Small speed up to cookiejar Using `str.format` is ~16% faster than the lambda followup to #7944 (comment). I was hoping to use `join` there but later realized `str.format` will take `*args` ## Are there changes in behavior for the user? no ## Is it a substantial burden for the maintainers to support this? no benchmark ```python import timeit import itertools _FORMAT_PATH = "{0}/{1}".format path = "lolonglonglonglonglonglongng/path/to/a/file" print( timeit.timeit( 'itertools.accumulate(path.split("/"), _FORMAT_PATH)', globals=globals() ) ) print( timeit.timeit( 'itertools.accumulate(path.split("/"), lambda x, y: f"{x}/{y}")', globals=globals(), ) ) ``` Co-authored-by: J. Nick Koston <[email protected]>
- Loading branch information