Skip to content

Commit 8eebca0

Browse files
guohuideng2024Guohui Dengtunetheweb
authored
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>
1 parent 139b16f commit 8eebca0

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Developers are interested in the “device class” for the following known use-
1212
2. Normalize Metrics: analytics need to be able to normalize their metrics against the device-class.
1313
For instance, a 100ms long task is a more severe issue on a Pixel vs. on a low end device.
1414

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).
1616

1717
## Proposal
1818
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.
@@ -27,21 +27,18 @@ Proposed Client Hints Header for memory: `Sec-CH-Device-Memory`\
2727
where `<value>` is an approximation of the amount of RAM in GiB (floating point number).\
2828
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.
2929

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.
3231

33-
The following table illustrates some examples:
32+
The following table illustrates some examples (note no bounds are set in these examples):
3433

3534
| Actual in MiB | Rounded in MiB | Reported in GiB |
3635
|---------------|----------------|-----------------|
37-
| 500 | 512 | 0.5 |
38-
| 512 | 512 | 0.5 |
39-
| 768 | 512 | 0.5 |
40-
| 1000 | 1024 | 1 |
4136
| 1793 | 2048 | 2 |
42-
43-
A full list of possible values is as follows:
44-
0.25, 0.5, 1, 2, 4, 8
37+
| 3000 | 2048 | 2 |
38+
| 3072 | 2048 | 2 |
39+
| 3073 | 4096 | 4 |
40+
| 16384 | 16384 | 16 |
41+
| 24576 | 16384 | 16 |
4542

4643
#### Why separate header and rounding?
4744
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
6057
```
6158

6259
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:
6461
```
65-
Sec-CH-Device-Memory: 0.5
62+
Sec-CH-Device-Memory: 2
6663
```
6764

6865
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.

index.bs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Status: ED
77
ED: https://www.w3.org/TR/device-memory/
88
TR: https://www.w3.org/TR/device-memory/
99
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
1011
Former Editor: Shubhie Panicker, Google https://google.com
1112
Repository: w3c/device-memory
1213
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<
6970
<h3 dfn>Computing Device Memory Value</h3>
7071
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.
7172

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.
7374

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.
7576

7677
If <code>Sec-CH-Device-Memory</code> header field occurs in a message more than once, the last value overrides all previous occurrences.
7778

@@ -90,8 +91,6 @@ If <code>Sec-CH-Device-Memory</code> header field occurs in a message more than
9091
Sec-CH-Device-Memory: 1
9192
</pre>
9293

93-
A full list of possible values should be as follows: 0.25, 0.5, 1, 2, 4, 8
94-
9594
Device Memory JS API {#sec-device-memory-js-api}
9695
=======================================
9796
<pre class="idl">

0 commit comments

Comments
 (0)