GitHubivarvong
ply
main
1// version:refname (issue #124). Two products, both judged by `git tag -l --sort=version:refname`.
2//
3// Pairs: every unordered pair of names from left × mid × end, plus a unicode slice, under every versionsort.suffix
4// list. A cell is one pair under one list. The oracle is two-name git, which is versioncmp. A suffix list that puts
5// the release between prereleases makes versioncmp cyclic (00.1-gamma < 00.2-alpha < 00.10-alpha < 00.1-gamma), so
6// those cells are pairs, not a listing.
7//
8// Ranks: every name of the larger product under every list. Where versioncmp orders the whole list, git's listing
9// equals a sort by compareVersionRefnames. Where it cycles, the listing inverts at least one cycle edge, and
10// two-name git on that edge agrees with versioncmp.
12/** @type {readonly string[]} */
13export const PAIR_LEFTS = Object.freeze(['0', '00', '1', '2', '10', '01']);
14/** @type {readonly string[]} */
15export const PAIR_MIDS = Object.freeze(['', '.1', '.2', '.10', '.01']);
16/** @type {readonly string[]} */
17export const PAIR_ENDS = Object.freeze(['', '-rc1', '-alpha', '-gamma']);
19/** @type {readonly string[]} */
20export const UNICODE_PREFIXES = Object.freeze(['é', '\uE000', '\u{10000}']);
21/** @type {readonly string[]} */
22export const UNICODE_LEFTS = Object.freeze(['1', '10']);
23/** @type {readonly string[]} */
24export const UNICODE_MIDS = Object.freeze(['', '.1']);
25/** @type {readonly string[]} */
26export const UNICODE_ENDS = Object.freeze(['', '-alpha']);
28/** @type {readonly string[]} */
29export const PREFIXES = Object.freeze(['', 'a', 'b', 'v', 'foo', 'é', '\uE000', '\u{10000}']);
30/** @type {readonly string[]} */
31export const LEFTS = Object.freeze(['0', '00', '1', '2', '9', '10', '01', '99', '100']);
32/** @type {readonly string[]} */
33export const MIDS = Object.freeze(['', '.0', '.1', '.2', '.3', '.6', '.7', '.8', '.9', '.10', '.01']);
34/** @type {readonly string[]} */
35export const ENDS = Object.freeze([
36 '', '-rc1', '-rc2', '-alpha', '-beta', '-gamma', '-delta',
37 '-pre1', '-pre2', '-prerelease1', '-before1', '-after1', '-foo-bar', '-foo-baz', '-unlisted-suffix',
38]);
40// Each list is versionsort.suffix in config order. '' is the release, placed among the suffixes (git's own tests).
41/** @type {readonly { readonly tag: string, readonly suffixes: readonly string[] }[]} */
42export const SUFFIX_CONFIGS = Object.freeze([
43 { tag: 'none', suffixes: [] },
44 { tag: 'rc', suffixes: ['-rc'] },
45 { tag: 'before', suffixes: ['-before'] },
46 { tag: 'before-after', suffixes: ['-before', '-after'] },
47 { tag: 'pre', suffixes: ['-pre', '-prerelease'] },
48 { tag: 'foo-bar', suffixes: ['-bar', '-foo-baz', '-foo-bar'] },
49 { tag: 'release-between', suffixes: ['-alpha', '-beta', '', '-gamma', '-delta'] },
50 { tag: 'release-first', suffixes: ['', '-rc'] },
51 { tag: 'rc-then-release', suffixes: ['-rc', ''] },
52]);
54// versioncmp's order under release-between. The three edges cannot all hold in one listing.
55/** @type {readonly (readonly [string, string])[]} */
56export const CYCLE = Object.freeze([
57 ['00.1-gamma', '00.2-alpha'],
58 ['00.2-alpha', '00.10-alpha'],
59 ['00.10-alpha', '00.1-gamma'],
60]);
61export const CYCLIC_SUFFIX = 'release-between';
63const choose2 = n => (n * (n - 1)) / 2;
65export const PAIR_NAME_COUNT = PAIR_LEFTS.length * PAIR_MIDS.length * PAIR_ENDS.length;
66export const UNICODE_NAME_COUNT = UNICODE_PREFIXES.length * UNICODE_LEFTS.length * UNICODE_MIDS.length * UNICODE_ENDS.length;
67export const PAIR_CELL_COUNT = (choose2(PAIR_NAME_COUNT) + choose2(UNICODE_NAME_COUNT)) * SUFFIX_CONFIGS.length;
68export const NAME_COUNT = PREFIXES.length * LEFTS.length * MIDS.length * ENDS.length;
69export const RANK_CELL_COUNT = NAME_COUNT * SUFFIX_CONFIGS.length;
70export const CELL_COUNT = PAIR_CELL_COUNT + RANK_CELL_COUNT;
72/** @param {readonly string[]} prefixes @param {readonly string[]} lefts @param {readonly string[]} mids @param {readonly string[]} ends */
73export function product(prefixes, lefts, mids, ends) {
74 const out = [];
75 for (const prefix of prefixes) {
76 for (const left of lefts) {
77 for (const mid of mids) {
78 for (const end of ends) out.push(`${prefix}${left}${mid}${end}`);
79 }
80 }
81 }
82 return out;
83}
85/** Every name of the rank product, in axis order. */
86export function names() {
87 return product(PREFIXES, LEFTS, MIDS, ENDS);
88}
90/** The pair-product names (no prefix). */
91export function pairNames() {
92 return product([''], PAIR_LEFTS, PAIR_MIDS, PAIR_ENDS);
93}
95/** The unicode slice of the pair product. */
96export function unicodeNames() {
97 return product(UNICODE_PREFIXES, UNICODE_LEFTS, UNICODE_MIDS, UNICODE_ENDS);
98}
100/** @param {readonly string[]} list */
101export function pairsOf(list) {
102 /** @type {[string, string][]} */
103 const out = [];
104 for (let i = 0; i < list.length; i++) {
105 for (let j = i + 1; j < list.length; j++) out.push([list[i], list[j]]);
106 }
107 return out;
108}
Diagnostics7 git calls · 118 ms
CallStatusSizeTime0118 ms
discover200191 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=191 git.server.agent=git/github-9922ec520325-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=191 git.pkt.payload.max=36
ls-refs20012 KiB · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=11990 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=152 git.pkt.data=151 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=11990 git.pkt.payload.max=122 git.ls_refs.count=151 git.ls_refs.head=refs/heads/main
fetchtree:0 · deepen 102004.2 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=4347 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=4347 git.pkt.payload.max=4247 git.sideband.band1.bytes=4247 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=4247 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=a6caf8e129bea82c9bae4cbc7c130c9205add400 git.pack.full=10Open pack map
fetchtree:0200919 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=919 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=800d30ba8923860bfc460ca884b7f9ba22083588 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=919 git.pkt.payload.max=892 git.sideband.band1.bytes=892 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=892 git.pack.trailer=5323b9266eea5ded637285d1c5320699f12be76eOpen pack map
fetchtree:02005.6 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=5724 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=58fabb6768b3f737ee9cd8bac647bdc27405fb4d git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=5724 git.pkt.payload.max=5697 git.sideband.band1.bytes=5697 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=5697 git.pack.trailer=be7e0453974a5fe832f9065a33bb7e3434c10e9bOpen pack map
fetchtree:02001.4 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=106 git.response.bytes=1428 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=74d7bb09987bbe78a9c0ea8f43a1b5a4e079f538 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1428 git.pkt.payload.max=1401 git.sideband.band1.bytes=1401 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=1401 git.pack.trailer=65ea1a3aeef333a80a2dfa3f441e629d90497e8eOpen pack map
fetch2001.5 KiB107 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1576 git.response.cache=MISS git.response.duration_ms=107 git.fetch.wants=41a7ce81a88492bdc4611128a19d9c605700db1e git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1576 git.pkt.payload.max=1549 git.sideband.band1.bytes=1549 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://github.com/ivarvong/ply
- Ref
- refs/heads/main
- Commit
- 19912563f540228593df0c489082e5e2508e21e4
- cf-ray
- a5e15f66dab9725b
- Request
- c90561ef…
- Protocol
- v2 · sha1
- Agent
- git/github-9922ec520325-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format