The performance of URL signing is critical for External API request that retrieve publications of events where each URI of each published elements needs to be signed.
The current implementation does a brute force comparison of the URL to be signed vs. the URL prefixes that can be signed. This is not only because of the algorithm that is in O(n) but it also seems that the functional implementation requires some high-overhead transformations of data structures.
The goal of this task is to use a O(log(n)) algorithm and avoid expensive transformations of data structures.
?withpublications=true&sign=true for a event with approx. 40 URLs to be signed takes approx. 40ms with the current code and 30ms with this optimization, whereas approx. 20ms are required without URL signing. So the overhead of enabling URL signing is cut in half.