-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Symfony version(s) affected: 4.1.3 (havent test other)
Description
IDK if it was discussed in the past but recently i was checking symfony serializer (ObjectNormalizer) performance, and in dev env it was faster than in prod. I have configured opcache just like in docs, xdebug disabled.
My test is serializing 1000 objects with various scalar value properies + one property is an object + one property holds 5-15 small objects in array.
Serialize took about 2184 ms
prod env, 152 ms
dev env.
How to reproduce
My actual test https://github.com/martiis/symfony-serialization-bench/blob/master/src/Command/BenchSymfonySerializerCommand.php#L78
Possible Solution
Found out that in prod CacheClassMetadataFactory does not keep loaded classes like ClassMetadataFactory and everytime it goes into file system checking cache. I thought opcache should fix this but it didint or maybe i missed something? if I put $loadedClasses
property in CacheClassMetadataFactory
performance back as in dev env.
Additional context
Opcache config
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.interned_strings_buffer = 16