@@ -1499,31 +1499,7 @@ Once configured, the serializer uses the mapping to pick the correct class::
1499
1499
$repository = $serializer->deserialize($serialized, CodeRepository::class, 'json');
1500
1500
// instanceof GitHubCodeRepository
1501
1501
1502
- Performance
1503
- -----------
1504
-
1505
- To figure which normalizer (or denormalizer) must be used to handle an object,
1506
- the :class: `Symfony\\ Component\\ Serializer\\ Serializer ` class will call the
1507
- :method: `Symfony\\ Component\\ Serializer\\ Normalizer\\ NormalizerInterface::supportsNormalization `
1508
- (or :method: `Symfony\\ Component\\ Serializer\\ Normalizer\\ DenormalizerInterface::supportsDenormalization `)
1509
- of all registered normalizers (or denormalizers) in a loop.
1510
-
1511
- The result of these methods can vary depending on the object to serialize, the
1512
- format and the context. That's why the result **is not cached ** by default and
1513
- can result in a significant performance bottleneck.
1514
-
1515
- However, most normalizers (and denormalizers) always return the same result when
1516
- the object's type and the format are the same, so the result can be cached. To
1517
- do so, make those normalizers (and denormalizers) implement the
1518
- :class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ CacheableSupportsMethodInterface `
1519
- and return ``true `` when
1520
- :method: `Symfony\\ Component\\ Serializer\\ Normalizer\\ CacheableSupportsMethodInterface::hasCacheableSupportsMethod `
1521
- is called.
1522
-
1523
- .. note ::
1524
-
1525
- All built-in :ref: `normalizers and denormalizers <component-serializer-normalizers >`
1526
- as well the ones included in `API Platform `_ natively implement this interface.
1502
+ .. include :: /serializer/_performance_tip.rst.inc
1527
1503
1528
1504
Learn more
1529
1505
----------
0 commit comments