amp-library
amp-library copied to clipboard
Performance: Instanciating the AMP class takes 120ms
Hello,
Above all, I would like to thank you for the high quality and reliability of this library. I'm using it for on demand conversion of my HTML pages to AMP, in a Symfony application.
But just after the deployment this feature on production, I noticed a huge performance slump. Average response time went from 90ms to 210ms. The only fact of instantiating the AMP
class takes 120ms, even if it is not used.
✗ blackfire run php amp-console amp:convert sample-html/sample-html-fragment.html
Here is a Blackfire profile that spot the glutton:
We can clearly see that the init of the library creates 18679 instances ofLullabot\AMP\Validate\ParsedAttrSpec
and makes 93545 calls to Lullabot\AMP\Validate\ParsedAttrSpec::getSpec()
.
Is there any way to make a lighter HTML conversion, without the huge performance cost of loading the validation rules ?
we're experiencing the same issue here
same issues here, does anyone find a fix for that?