static performance increase

This commit is contained in:
Adam Hopkins 2021-02-09 16:39:03 +02:00
parent b850e49cb3
commit b89f9a57e0

View File

@ -23,6 +23,10 @@ class Router(BaseRouter):
DEFAULT_METHOD = "GET" DEFAULT_METHOD = "GET"
ALLOWED_METHODS = HTTP_METHODS ALLOWED_METHODS = HTTP_METHODS
# Putting the lru_cache on Router.get() performs better for the benchmarsk
# at tests/benchmark/test_route_resolution_benchmark.py
# However, overall application performance is significantly improved
# with the lru_cache on this method.
@lru_cache(maxsize=ROUTER_CACHE_SIZE) @lru_cache(maxsize=ROUTER_CACHE_SIZE)
def _get(self, path, method, host): def _get(self, path, method, host):
try: try: