summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:14:52 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-24 13:14:52 +0000
commitbf123925f61f4511db7b2e3c1e9f31199edc7502 (patch)
treee36069bb3dc32e02ddeb449b89b1a3bc46688ccb
parentIncrease DB/CPU perf of `_is_server_still_joined` check. (#6936) (diff)
parentTiny optimisation for _get_handler_for_request (#6950) (diff)
downloadsynapse-bf123925f61f4511db7b2e3c1e9f31199edc7502.tar.xz
Tiny optimisation for _get_handler_for_request (#6950)
* commit 'abf1e5c52':
  Tiny optimisation for _get_handler_for_request (#6950)
-rw-r--r--changelog.d/6950.misc1
-rw-r--r--synapse/http/server.py4
2 files changed, 4 insertions, 1 deletions
diff --git a/changelog.d/6950.misc b/changelog.d/6950.misc
new file mode 100644

index 0000000000..1c88936b8b --- /dev/null +++ b/changelog.d/6950.misc
@@ -0,0 +1 @@ +Tiny optimisation for incoming HTTP request dispatch. diff --git a/synapse/http/server.py b/synapse/http/server.py
index 04bc2385a2..042a605198 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py
@@ -353,10 +353,12 @@ class JsonResource(HttpServer, resource.Resource): if request.method == b"OPTIONS": return _options_handler, "options_request_handler", {} + request_path = request.path.decode("ascii") + # Loop through all the registered callbacks to check if the method # and path regex match for path_entry in self.path_regexs.get(request.method, []): - m = path_entry.pattern.match(request.path.decode("ascii")) + m = path_entry.pattern.match(request_path) if m: # We found a match! return path_entry.callback, path_entry.servlet_classname, m.groupdict()