Amphtml: I2I: increase CSS byte limit to 112.5kb for Transformed AMP

Created on 15 Jan 2021  路  5Comments  路  Source: ampproject/amphtml

Summary

This proposal is to increase the CSS limit from 75kb to 112.5kb for Transformed AMP.

AMP limits CSS for performance and, dare I say, developer laziness of cleaning CSS up (we've all been there). The current AMP specification is a CSS limit of combined <style> and inline styles (style="") at 75kb. This is enforced by the AMP Validator.

Design document

Over time there have been requests to exclude byte counts for certain beneficial CSS behavior. Things like server side rendering or data URLs being the most recent. Rather than continue to debate each of these requests the @ampproject/wg-caching team is proposing that the byte limit for Transformed AMP (<html amp transformed=self>) is increased to 112.5kb. This will only be for Transformed AMP and not for other AMP documents.

This will address issues like #30726 and #31512. Future issues requesting increased usage will be directed here as we do not intend to provide one-off relief given this increase.

The increase is trivial to implement as it requires just a protoascii change. The change will be to increase max_bytes: 75000 to max_bytes: 112500. The inline style limit will continue to be max_bytes_per_inline_style: 1000

Motivation

As AMP adoption has increased there have been request to provide additional bytes for CSS. Since this may be an ongoing request, rather than address each issue individually, the limit can be increased to satisfy all conditions and continue to provide reasonable performance that AMP has delivered.

Additional context

See requests such as #30726, #31512, #26466, #11881, #17269

Stretch but including: #22535, #22418

/cc @ampproject/wg-caching, @sebastianbenz (author of #31512), @westonruter (author of #30726).

INTENT TO IMPLEMENT caching

Most helpful comment

Reopening. Will also increase inline style to 1500 bytes.

All 5 comments

This would definitely help. How did you come up with 112,5kb as the new limit? Wondering whether a page using blurry placeholders and lots of media attributes could still hit the limit.

Unfortunately, this proposal won't help with #31512 as it also requires raising the inline style limit.

@sebastianbenz It's a buffer. It's not intended to be mathematical or precise (though you're welcome to propose one with such backing). What type of buffer would you recommend for inline style? Ideally it's reasonable and not overly gracious.=D

75kb x 1.5 = 112.5kb. It's a 50% buffer.

Reopening. Will also increase inline style to 1500 bytes.

This makes sense to me, and hopefully eliminates concerns around the impact of transforms on CSS payloads.

Was this page helpful?
0 / 5 - 0 ratings