Browse Source
get_openapi_path called get_flat_dependant on the same route 3 times: once directly, once inside _get_openapi_operation_parameters, and once inside get_flat_params. All three computed the identical result. Hoist the computation before the method loop and pass the result to the internal consumers. This eliminates 2 redundant dependency-tree traversals per route during schema generation. Benchmark (10-200 routes, 3 deps each, Python 3.11): | Routes | Speed Δ | RAM Δ | |--------|---------|-------| | 10 | −11 % | ~0 % | | 50 | −6 % | 0 % | | 100 | −7 % | 0 % | | 200 | −10 % | 0 % |pull/15622/head
1 changed files with 9 additions and 5 deletions
Loading…
Reference in new issue