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 — Improve performance of exceptions · Issue #161242 · python/cpython Open Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementRaising exceptions in python is rather expensive: d = {'a': 'b', 'c': 1} def f(): try: return d['x'] except: pass def g(): if 'x' in d: return d['x'] %timeit f() %timeit g() 211 ns ± 1.08 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) 31.5 ns ± 0.265 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each) We can improve this by using freelists (for tracebacks and exceptions), using managed dicts for exceptions and improving the performance of attribute setters. 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 Linked PRsReacted by Cody Maloney Activity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance 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. |