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 — Use PEP 669 API for cprofile · Issue #103533 · python/cpython Closed Labels performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementReplace the current PitchIt's faster. Before: After: 20%+ speed up for overhead. I guess the incentive is not in doubt, but I did have some issues when I implemented it.
# This works on main, but I don't think that's intuitive. pr = cProfile.Profile() pr.enable() pr = cProfile.Profile() pr.disable() We can make it work as before, I just think this is not the right way to do it with PEP 669. Because of this, I changed an old (15 years) test in
Addendum: Benchmark Codeimport timeit hanoi_setup = """ import cProfile def test(): def TowerOfHanoi(n, source, destination, auxiliary): if n == 1: return TowerOfHanoi(n - 1, source, auxiliary, destination) TowerOfHanoi(n - 1, auxiliary, destination, source) TowerOfHanoi(16, "A", "B", "C") pr = cProfile.Profile() """ fib_setup = """ import cProfile def test(): def fib(n): if n <= 1: return 1 return fib(n - 1) + fib(n - 2) fib(21) pr = cProfile.Profile() """ test_baseline = """ test() """ test_profile = """ pr.enable() test() pr.disable() """ baseline = timeit.timeit(test_baseline, setup=hanoi_setup, number=100) profile = timeit.timeit(test_profile, setup=hanoi_setup, number=100) print(f"Hanoi: {baseline}, {profile}, {profile / baseline}") baseline = timeit.timeit(test_baseline, setup=fib_setup, number=100) profile = timeit.timeit(test_profile, setup=fib_setup, number=100) print(f"fib: {baseline}, {profile}, {profile / baseline}") Linked PRsActivity
MetadataMetadataAssigneesLabelsperformancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-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. |