GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Performance regression in `shlex.quote` from 3.13 to 3.14 · Issue #146385 · python/cpython Open Labels 3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesperformancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:#132036 included an algorithmic change to However, the Cc @picnixz import re import shlex import timeit # From 3.13 _find_unsafe = re.compile(r'[^\w@%+=:,./-]', re.ASCII).search def old_quote(s): """Return a shell-escaped version of the string *s*.""" if not s: return "''" # BEST: if s.isascii() and _find_unsafe(s) is None: if _find_unsafe(s) is None: return s # use single quotes, and put single quotes into double quotes # the string $'b is then quoted as '$'"'"'b' return "'" + s.replace("'", "'\"'\"'") + "'" g = {'old_quote': old_quote, 'new_quote': shlex.quote} print('with spaces') print(' old', timeit.timeit("old_quote('the quick brown fox jumps over the lazy dog')", globals=g, number=1000000)) print(' new', timeit.timeit("new_quote('the quick brown fox jumps over the lazy dog')", globals=g, number=1000000)) print('without spaces') print(' old', timeit.timeit("old_quote('thequickbrownfoxjumpsoverthelazydog')", globals=g, number=1000000)) print(' new', timeit.timeit("new_quote('thequickbrownfoxjumpsoverthelazydog')", globals=g, number=1000000)) print('non-ASCII') print(' old', timeit.timeit("old_quote('mötley')", globals=g, number=1000000)) print(' new', timeit.timeit("new_quote('mötley')", globals=g, number=1000000)) print('short') print(' old', timeit.timeit("old_quote('a')", globals=g, number=1000000)) print(' new', timeit.timeit("new_quote('a')", globals=g, number=1000000)) sample output: CPython versions tested on:3.14 Operating systems tested on:Linux Linked PRsActivity
MetadataMetadataAssigneesLabels3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesperformancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |