You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Emphasize the bounds can be dymanically adjusted by implements (#53)
* Emphasize the bounds can be dymanically adjusted by implements
And remove the recommend bounds that are out of date.
Bug:#50
* Remove "geographic regions".
* Update examples using outdated limits
* Update examples
---------
Co-authored-by: Guohui Deng <guohuideng@microsoft.com>
Co-authored-by: Barry Pollard <barrypollard@google.com>
Copy file name to clipboardExpand all lines: README.md
+10-13Lines changed: 10 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Developers are interested in the “device class” for the following known use-
12
12
2. Normalize Metrics: analytics need to be able to normalize their metrics against the device-class.
13
13
For instance, a 100ms long task is a more severe issue on a Pixel vs. on a low end device.
14
14
15
-
Device memory is an interesting signal in this context. Low memory devices devices (under 512MB, 512MB-1GB) are widely used in emerging markets. Chrome telemetry indicates a large number of OOM (out-of-memory) crashes on foreground tabs on these devices. In this case, serving a lite version not only improves the user experience, it is necessary for the site to be usable at all (as opposed to crashing due to memory constraints).
15
+
Device memory is an interesting signal in this context. Low memory devices devices are widely used in emerging markets. Chrome telemetry indicates a large number of OOM (out-of-memory) crashes on foreground tabs on these devices. In this case, serving a lite version not only improves the user experience, it is necessary for the site to be usable at all (as opposed to crashing due to memory constraints).
16
16
17
17
## Proposal
18
18
We propose a new HTTP Client Hints header and a web exposed API to surface device capabilities for memory (RAM). The mechanism should be extensible to other device capabilities such as CPU i.e. number of cores, clock speed etc.
where `<value>` is an approximation of the amount of RAM in GiB (floating point number).\
28
28
The `<value>` is calculated by using the actual device memory in MiB then rounding it to the nearest number where only the most significant bit can be set and the rest are zeros (nearest power of two). Then dividing that number by 1024.0 to get the value in GiB.
29
29
30
-
An upper bound and a lower bound should be set on the list of values. While implementations may choose different values, the recommended upper bound is 8GiB and the recommended lower bound is 0.25GiB (or 256MiB).
31
-
The upper and lower bounds are not explicit, as they are subject to change over time.
30
+
An upper bound and a lower bound should be set on the list of values so the fingerprinting is mitigated. The Implementations may set upper and lower bounds and adjust them dynamically over time. These bounds may even differ on different device types.
32
31
33
-
The following table illustrates some examples:
32
+
The following table illustrates some examples (note no bounds are set in these examples):
34
33
35
34
| Actual in MiB | Rounded in MiB | Reported in GiB |
HTTP caching doesn't deal well with mixed value headers, therefore separate headers are recommended. Also, rounding down to power of two enables caching and mitigates fingerprinting.
@@ -60,9 +57,9 @@ Servers can advertise support for Client Hints using the Accept-CH header field
60
57
```
61
58
62
59
The Memory request header field is a number for the client’s device memory i.e. approximate amount of ram in GiB.
63
-
eg. 512 MiB will be reported as:
60
+
eg. 2024 MiB will be reported as:
64
61
```
65
-
Sec-CH-Device-Memory: 0.5
62
+
Sec-CH-Device-Memory: 2
66
63
```
67
64
68
65
Servers can use this header to customize content for low memory device eg. serve light version of the app or a component such as a video player.
Copy file name to clipboardExpand all lines: index.bs
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ Status: ED
7
7
ED: https://www.w3.org/TR/device-memory/
8
8
TR: https://www.w3.org/TR/device-memory/
9
9
Editor: Barry Pollard, Google https://google.com, barrypollard@google.com, w3cid 138839
10
+
Editor: Guohui Deng, Microsoft https://microsoft.com, guohuideng@microsoft.com, w3cid 158258
10
11
Former Editor: Shubhie Panicker, Google https://google.com
11
12
Repository: w3c/device-memory
12
13
Abstract: This document defines a HTTP Client Hint header and a JavaScript API to surface device capability for memory i.e. device RAM, in order to enable web apps to customize content depending on device memory constraints.
@@ -69,9 +70,9 @@ The ABNF (Augmented Backus-Naur Form) syntax for the <code>Sec-CH-Device-Memory<
69
70
<h3 dfn>Computing Device Memory Value</h3>
70
71
The value is calculated by using the actual device memory in MiB then rounding it to the nearest number where only the most significant bit can be set and the rest are zeros (nearest power of two). Then dividing that number by 1024.0 to get the value in GiB.
71
72
72
-
An upper bound and a lower bound should be set on the list of values.
73
+
An upper bound and a lower bound should be set on the list of values. The range between the upper and the lower bounds should include the majority of device memory values but exclude rare device memory values to mitigate device fingerprinting.
73
74
74
-
NOTE: While implementations may choose different values, the recommended upper bound is 8GiB and the recommended lower bound is 0.25GiB (or 256MiB).
75
+
NOTE: The Implementations may set upper and lower bounds and adjust them dynamically over time. These bounds may even differ on different device types.
75
76
76
77
If <code>Sec-CH-Device-Memory</code> header field occurs in a message more than once, the last value overrides all previous occurrences.
77
78
@@ -90,8 +91,6 @@ If <code>Sec-CH-Device-Memory</code> header field occurs in a message more than
90
91
Sec-CH-Device-Memory: 1
91
92
</pre>
92
93
93
-
A full list of possible values should be as follows: 0.25, 0.5, 1, 2, 4, 8
0 commit comments