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 — Optimize UTF-8 decoding to UCS1 · Issue #158931 · python/cpython Open Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedperformancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementIs it expected that decoding 2-byte UTF-8 sequences to UCS1 is no faster than decoding them to UCS2? I thought UCS1 would have an advantage because the resulting string uses half as much memory and requires half as many bytes to be written. $ python -VV Python 3.15.0rc3 (tags/v3.15.0rc3:8a8eb0b, Oct 2 2026, 19:16:27) [MSC v.1951 64 bit (AMD64)] $ python -m timeit -s 's = ("\x80" * 65_536).encode()' 's.decode()' 5000 loops, best of 5: 98.8 usec per loop $ python -m timeit -s 's = ("\u0100" * 65_536).encode()' 's.decode()' 5000 loops, best of 5: 98.7 usec per loop For comparison, the corresponding encoding operations do show a difference: $ python -m timeit -s 's = "\x80" * 65_536' 's.encode()' 5000 loops, best of 5: 69.1 usec per loop $ python -m timeit -s 's = "\u0100" * 65_536' 's.encode()' 1000 loops, best of 5: 99.9 usec per loop Has this already been discussed elsewhere?This is a minor feature, which does not need previous discussion elsewhere Links to previous discussion of this feature:No response Activity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedperformancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement 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. |