-
Notifications
You must be signed in to change notification settings - Fork 28
Group names bikeshed #7
Comments
I imagine that we will have more rounds of bikeshedding but I agree we should start with keywords that are aligned in their intent. Let's see: If the point of Priority Hints is to allow developers to convey how important they think a particular resource is, then it follows that the keywords should be about the "how/when" (e.g. critical, late) and not so much about the "what" (e.g. font). In particular, the "what" seems easy to figure out from the type of resource, no? Does it matter to convey the "why" (e.g. text, functional)? Is it something that the UA can reliably infer from the type of the resource? Or perhaps the "why" should be about explaining why the UA should care (e.g. "render-blocking", "interactive-blocking")? I think there is value in a scheme that explains the "why should you care" as it should avoid ending up with developers putting "critical" on all the things. Strawman: groups made of reasons and importance (e.g. "render-critical")
Hmm, perhaps "unimportant" should be allowed to be used without a reason? Thoughts? |
+1 to the points that mixing "how/when" and "what" would make things complex, or would give people wrong signals. I prefer we start with the term that clearly only indicates the importance, but am interested in what use cases would fall out if we do so. |
"reason/importance" makes sense to me. We probably want to add |
I'm a little worried about going with "importance" rather than "type of thing". Let's say I want one of my scripts to be lower priority than others. In order to fix that, I need to figure out which priority the other scripts implicitly have, and give it the priority lower than that. Let's say the values are 'low', 'medium', 'high' and 'critical', and it appears that scripts are 'high', so I pick 'medium' for this particular script. As a developer, I'm having to translate from type to importance to get the behaviour I want. However, I'm aware that browsers experiment with priorities, and the default priority for scripts may not always be 'high'. That means my value that was intended to be relative to other scripts, may break in future. To fix this, I assign priorities to all the other scripts. However, this may mess around with the priority of the scripts vs CSS, so now I have to add priorities to the CSS too, then imgs etc etc. In the end, if I want control, I have to assign priorities to everything. |
To echo @jakearchibald, be really really careful with this (and maybe developer test it first, by getting a group of devs together and asking them to apply these labels to simple site just to see what they do)... we got burnt by this kind of thing in other specs: developers tend label things as "what it is" and not "what I actually want is...". |
I'm concerned the current named fetch-groups are going to be a little unintuitive for a developer to reason about in the context of a modern webapp. Much of this comes down to the point of making it easy to reason about "when a group is fetched". Let's walk through an example, say Twitter Lite, assuming I don't have knowledge of a browser's network stack or how priorities work:
In this case, I actually didn't mind needing to manually annotate my page using the different fetch-groups. I did run into a few cases where I was left guessing "when" a resource would be loaded. If the names could somehow reflect this better I think it could massively help minimize confusion. |
This is the sort of thing I'm worried about. The lower priorities feel really risky, because you're not sure what might be prioritised above them. Maybe this wouldn't be such a problem if I was able to express "these images should have higher priority than these analytics pings". |
I looked around for a while and was surprised to see that the priorities weren't (nor were called out as a consideration to have been) number values. What's the reasoning to not use When looking at Twitter Lite, for example, @addyosmani is pretty spot on. The only thing that I'd add is that the priorities will need to change based on what the visitor's landing page happens to be. While Whereas if we were to use a numbering system, it might look like this:
|
My concerns in #7 (comment) stand for a numbered system too. A numbered system would be like |
@jakearchibald Without defining a true priority, how do you envision you would manage cases where "type of thing" doesn't match with what the actual desired priority is (e.g. In my experience, type often does a poor job of defining importance and I end up having to do a lot of work anyway to figure out which particular script/image/mp3/mkv/woff/etc is more important than something else. We're already splitting bundles into separate chunks, and we know their priority and can define them, but our systems don't and have a really hard time automating which one should be loaded first.
Why would browsers assign different default values? Do we just expect browsers to never follow standards, and therefore we shouldn't even try defining them? |
How would this be different in a numbered system? Surely the only difference is you'd have to translate that particular script/image/mp3/mkv/woff/etc into a number, or assign one.
The alternative is we say something like "scripts are higher priority than stylesheets", and compliant browsers would have to do that, even if, 10 years later, that turns out to be bad for performance. I'm not sure our priority guesses 10 years ago would be the best choices for today. |
I talked to @pmeenan about the above and he proposed something interesting. Browsers would be able to further experiment with those resources' priorities, while respecting their relative importance. It is true that you won't be able to absolutely define a resource Y as "more important than type X", but in return browsers would be able to continue to experiment with resource priorities while giving developers enough expressive power to define their intentions (and won't cause the same confusion that @addyosmani described in his comment). Defining such importance levels (e.g.
|
Specifying importance sounds good to me, and seems to resolve some of the issues that were pointed out so far. One of the potential downside would be that it wouldn't allow developers to give some ordering or dependency hints over multiple types of resources, but maybe it's still just okay as they can still give indirect hints by giving different priorities? I'd like to hear how other developers might feel. |
I like the idea of defining importance and ensuring browsers can keep adjusting resource priorities independent of the hinting control we offer developers. I don't think we lose that much without being able to specify as strong a relative mapping with "X is more important than Y". I'd be curious to hear @igrigorik's take on this too. My main concern with defining importance levels with the suggested labels (critical, high, medium, low, unimportant) is the guarantees they might imply. These labels aren't too far away from the network priority names we use in Chrome (high, medium, low etc) and might come across as more of a "we're guaranteeing you'll be able to specify this importance and the browser will have to respect it" vs a hint. I felt "fonts", "functional", "visual" and "late" didn't quite set this expectation, but.. I might be overthinking the naming here. Perhaps it's fine for us to keep a very similar nomenclature to the existing priorities and setting expectations is more of a docs/advocacy issue. I could see developers understanding critical, high etc. without too much explanation otherwise. |
I'm supportive of the idea of conveying the importance as I initially indicated. We can refine the keywords to avoid confusion with existing network priorities expressed in browsers. Re: ordering and dependencies. I think these are out of scope for this proposal. Priority-hints (hmm, Importance-hints ?) is meant for use cases centered around independent resources (e.g. this async script is actually critical for a fast render, this image is actually the primary content of the page). With ordering and dependencies, the UA would need the full picture to properly fulfill the developer's intent. This suggests a different API. Perhaps, a loading manifest ? |
As we've converged on |
Right now the group names in the explainer are:
critical
,fonts
,functional
,visual
andlate
.There are not necessarily good names, and we need to come up with better ones.
As @jakearchibald pointed out,
fonts
is unlike the others as it says "what is this resource" vs. "when is this group fetched".Maybe we can replace it with
textcritical
?Otherwise, thoughts on the other names?
cc @addyosmani @KenjiBaheux @jakearchibald
The text was updated successfully, but these errors were encountered: