WICG/priority-hints

importance vs priority

Malvoz opened this issue · 6 comments

Is there a reason why this attrbute is called importance and not priority? E.g. could resources not be equally important but prioritized differently?

I realize "importance" in this sense refers to how to treat a resource, and not how important a resource is to e.g. site functionality. To me the priority name is more self explanatory.

A bit of this can be seen here (#7 (comment)) and here (#12), but mostly it revolves around the fact that we don't want to give developers the impression that we're letting them assign a true resolved/overridden priority to assets (for example, importance=high does not mean the browser will assign priority of high). Instead, importance allows developers to give a hint to the browser saying "hey, this resource is pretty important to the page, if you could perhaps take this into consideration when prioritizing other resources of the same kind that would be nice".

Basically, some images might be more important than other images, so importance=high on an image might suggest to a UA to bump up the resolved priority of this image as much as it feels comfortable doing (after all, it's only an image). If we were to use priority=high this might suggest that the browser will automatically prioritize the image at the same priority of render-blocking CSS, which should never be the case and can cause serious regressions. Hopefully that makes sense, Addy and Yoav might be able to provide more.

Thanks @domfarolino,
In those issues the only time priority as an attribute name was mentioned was in conjuction to define the priority using numebered values instead of the current system of unimportant to critical (which I'm not questioning) and not necessarily an argument for the name priority.

I understand a resource may be prioritized lower than another resource marked with the same hint. But I don't see why this could not be the case with priority as the attribute name aswell.

I mean this is a hint API, so if it is importance or priority it'll still be understood to be just hints either way.

I guess personally I'm just more fond of priority than importance.

This is true, but since the priority keyword was indeed at least considered in some context, and a pretty big thing we were/are worried about was what Addy wrote:

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

...it seems that this issue might further be amplified if we were to use priority (which I originally was more fond of too!). Related to this:

I mean this is a hint API, so if it is importance or priority it'll still be understood to be just hints either way.

I definitely see where you're coming from, but I somewhat disagree. If developers consistently see priority being used everywhere, regardless of the spec and implementation intentions, they may very easily mistake this as a hard-mapping priority API.

Does the definition of the word priority imply something is guaranteed to come before another thing? Or that something should preferably come before another?

Depends on the reader? IMO, setting priority equal to something implies a direct role in modifying, well, the actual priority of a resource, when it does not. Instead, we indicate how relevant a resource is to us, so that the browser can do what it wants. I personally think that some developers might think that in the following scheme, the image will be preferred to come before the style sheet:

...
<link rel=stylesheet href=main.css priority=low>
<img src=dom.png alt=dominic priority=high>
...

...which isn't the case, because CSS is render-blocking, and you'll never see CSS with low priority. So setting priority=low, and then seeing the resolved priority in the DevTools as high might be a little confusing.

I accept your answer, closing!