Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 4.1 |
As discussed in #24206, we currently have a perf issue with serialization, related to the fact that our supports*()
method are too dynamic and cannot be cached (supports can vary based on $context
and/or $data
, even if most normalizers vary only on "type($data)").
We spotted that if we allow normalizers to expose their vary-by characteristics, we might overcome the issue: we could add an new interface with a getProvidedTypes
method, that would return an array keyed by PHP-type/class (with a wildcard to match all types), valued by a bitfield of "vary" consts: DATA | CONTEXT | TYPE.
This would tell the outside what the supports*()
methods vary on, so that we could implement an accurate caching layer in Serializer
.