Skip to content

Commit 1aa27d8

Browse files
committed
Introduce a specific criteria for selecting one of many candidate invalidating patches during extension.
- For a set of patches who have the same intersection with the target subset definition and where that intersection is not a strict subset of any other intersections we know that exactly one of those patches will always be needed regardless of any other patch selections. - From there pick the one that has the smallest transfer size. - Here we use the ordering of a patch in the patch map as a signal for the relative transfer size of that patch. - Lastly, update encoding guidance to recommend encoders order map entries by transfer size ascending.
1 parent 5068d03 commit 1aa27d8

File tree

2 files changed

+99
-38
lines changed

2 files changed

+99
-38
lines changed

Overview.bs

+37-3
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,12 @@ The algorithm:
443443
7. Pick one <var>entry</var> from <var>entry list</var> with the following procedure:
444444

445445
* If <var>entry list</var> contains one or more [=patch map entries=] which have a patch format that is [=Full Invalidation=]
446-
then, select exactly one of the [=Full Invalidation=] entries in <var>entry list</var>. The criteria for selecting the single
447-
entry is left up to the implementation to decide.
446+
then, select exactly one of the [=Full Invalidation=] entries in <var>entry list</var>. Follow the criteria in
447+
[[#invalidating-patch-selection]] to select the single entry.
448448

449449
* Otherwise if <var>entry list</var> contains one or more [=patch map entries=] which have a patch format that is
450450
[=Partial Invalidation=] then, select exactly one of the [=Partial Invalidation=] entries in <var>entry list</var>.
451-
The criteria for selecting the single entry is left up to the implementation to decide.
451+
Follow the criteria in [[#invalidating-patch-selection]] to select the single entry.
452452

453453
* Otherwise select exactly one of the [=No Invalidation=] entries in <var>entry list</var>.
454454
The criteria for selecting the single entry is left up to the implementation to decide.
@@ -692,6 +692,32 @@ If the error occurred during [$Load patch file$] then, the client may continue t
692692
if there are remaining patches available other than the one(s) that failed to load. In the case of all other errors the client
693693
must not attempt to further extend the font subset.
694694

695+
Selecting Invalidating Patches {#invalidating-patch-selection}
696+
--------------------------------------------------------------
697+
698+
During execution of the [$Extend an Incremental Font Subset$] algorithm in some cases it's necessary to select a single invalidating (full or partial)
699+
patch entry from a list of candidate entries. The selection criteria used has a direct impact on the total number of round trips that will be needed to
700+
perform the extension. Round trips are costly so for maximum performance patches should be selected in a way that minimizes the total number of needed
701+
round trips.
702+
703+
The following selection criteria minimizes round trips and must be used by the client when selecting a single partial or full invalidation patch in step 7
704+
of [$Extend an Incremental Font Subset$]:
705+
706+
1. For each candidate entry compute the set intersection between each subset definition in the entry and the target subset definition. Union
707+
the resulting intersections together into a single subset definition.
708+
709+
2. Find an entry whose intersection subset definition from step 1 is not a strict subset of any other intersection subset definition.
710+
711+
3. Locate any additional entries that have the same intersection as the entry found in step 2. From the this set of entries (including the step 2 pick)
712+
the final selection is the entry which is listed first in the patch map. For [[#patch-map-format-1]] this is the entry with the lowest entry index.
713+
For [[#patch-map-format-2]] this is the entry that appears first in the [=Mapping Entries/entries=] array.
714+
715+
716+
Note: a fast and efficient way to find an entry which satisfies the criteria for step 2 is to sort the entries (descending) by the size of the code point
717+
set intersection, then the size of feature tag set intersection, and finally the size of the design space intersection. The first entry in this sorting is
718+
guaranteed to not be a strict subset of any other entries, since any strict super sets would have to be at least one item larger. This approach also has
719+
the added benefit that it selects the patch which will add the most data which the client is currently requesting.
720+
695721
Target Subset Definition {#target-subset-definitions}
696722
-----------------------------------------------------
697723

@@ -2384,6 +2410,14 @@ A, B, C, and D. The patch table could list patches that add: A, B, C, D, A + B,
23842410
allow any two segments to be added in a single round trip. The downside to this approach is that it further increases the number of unique
23852411
patches needed.
23862412

2413+
2414+
<b>Entry order in encoded patch mappings</b>
2415+
2416+
In [[#invalidating-patch-selection]] the client uses the order of an entry in the patch map to break ties when selecting which patches to load and apply.
2417+
Clients are aiming to reduce total transfer sizes so when multiple entries are tied in intersection size it's generally in the client's interest to choose
2418+
the patch which has the smallest total transfer size. As a result encoders should place entries in the patch map ordered from smallest to largest size in
2419+
bytes. This will ensure clients that when clients follow [[#invalidating-patch-selection]] they bias towards smaller patches and maximize performance.
2420+
23872421
<b>Managing the number of patches</b>
23882422

23892423
Using [[#table-keyed]] patches along side a large number of segments can result in a very large number of patches needed, which can have two

0 commit comments

Comments
 (0)