cedar-policy / cedar

Implementation of the Cedar Policy Language
https://www.cedarpolicy.com
Apache License 2.0
889 stars 80 forks source link

Investigate other uses of `serde(untagged)` for performance problems #1310

Open cdisselkoen opened 1 week ago

cdisselkoen commented 1 week ago

Describe the improvement you'd like to request

In #1308 we fixed a performance issue (#1284) by replacing an automatically derived serde(untagged) deserializer with a custom one, achieving orders of magnitude speedup on a pathological case. We should investigate if it's worth applying the same pattern in other places.

Describe alternatives you've considered

No response

Additional context

No response

Is this something that you'd be interested in working on?

john-h-kastner-aws commented 1 week ago

Fortunately, the list is not too long. Only one is a recursive data structure, which I believe was key in the pathological performance issue

All the rest are worth taking a closer look at, but they are not defined recursively, so the cost of the backtracking parsing for the derived untagged should only be paid once.