# Without cache start = time.perf_counter() result = fibonacci(n) normal_time = time.perf_counter() - start
import sys import time from functools import lru_cache Run with: PYTHON_JIT=1 python script.py def fibonacci(n): """Classic recursive function - JIT helps here""" if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2) Decorators are faster @lru_cache(maxsize=None) def fibonacci_cached(n): if n <= 1: return n return fibonacci_cached(n-1) + fibonacci_cached(n-2)
# List comprehension performance list_time = timeit.timeit( "[i * 2 for i in range(1000)]", number=100000 ) print(f"List comprehensions: list_time:.3fs")
# With cache (now faster decorator execution) start = time.perf_counter() result_cached = fibonacci_cached(n) cached_time = time.perf_counter() - start
import asyncio import time async def process_item(item): await asyncio.sleep(0.001) # Simulated I/O return item * 2
# Check for removed features checks = [ ("crypt", "Module 'crypt' removed in 3.13"), ("2to3", "Tool removed in 3.13"), ]