You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
canonical json encoding turns out to be in the hot path for most TUF tests (this happens if signing or verifying signatures is in the hot path).
Trying to heavily optimize this is probably not a good goal for securesystemslib but we could see if we can improve the code and improve performance at the same time... I'm looking at especially _canonical_string_encoder() which does essentially this:
return'"%s"'%re.sub(r'(["\\])', r'\\\1', string)
The obvious speedup is to compile the regex: this makes _canonical_string_encoder() >10% faster immediately.
But I wonder if it can be replaced by this (and is it clearly faster):
It is clearly faster: the actual _canonical_string_encoder() runtime is 75% smaller, and my TUF test case (that creates metadata and then loads it with Updater) runtime is 25% smaller.
So I think the question is, do the two calls really always have the same results?
canonical json encoding turns out to be in the hot path for most TUF tests (this happens if signing or verifying signatures is in the hot path).
Trying to heavily optimize this is probably not a good goal for securesystemslib but we could see if we can improve the code and improve performance at the same time... I'm looking at especially
_canonical_string_encoder()
which does essentially this:The obvious speedup is to compile the regex: this makes
_canonical_string_encoder()
>10% faster immediately.But I wonder if it can be replaced by this (and is it clearly faster):
The text was updated successfully, but these errors were encountered: