export type ServerTiming = { firstByteMs: number; doneMs: number; packBytes: number };
export type CloneCase = {
id: string;
label: string;
sailforkCommand: string;
gitCommand: string;
objects: number;
sailfork: ServerTiming;
git: ServerTiming;
};
// Measured on sailfork.com's clone race: server time to send the pack, median of 5 runs on one Apple M4 Max.
export const cpuPerGb = { sailfork: 0.591, git: 4.052 };
export const method = {
machine: 'one Apple M4 Max',
runs: 5,
gitVersion: '2.54',
repository: 'linux.git'
};
export const cases = [
{
id: 'clone',
label: 'Full clone',
sailforkCommand: 'git clone https://sailfork.com/torvalds/linux',
gitCommand: 'git clone file:///srv/git/linux.git',
objects: 11_845_633,
sailfork: { firstByteMs: 0.14, doneMs: 1_885.6, packBytes: 2_330_318_723 },
git: { firstByteMs: 4_502.19, doneMs: 8_887.9, packBytes: 2_178_813_895 }
},
{
id: 'depth',
label: 'Shallow clone',
sailforkCommand: 'git clone --depth 1 https://sailfork.com/torvalds/linux',
gitCommand: 'git clone --depth 1 file:///srv/git/linux.git',
objects: 101_713,
sailfork: { firstByteMs: 0.18, doneMs: 219.2, packBytes: 302_154_473 },
git: { firstByteMs: 2_855.27, doneMs: 13_390.3, packBytes: 287_036_517 }
},
{
id: 'fetch',
label: 'Fetch 100 commits',
sailforkCommand: 'git fetch origin',
gitCommand: 'git fetch origin',
objects: 8_434,
sailfork: { firstByteMs: 0.32, doneMs: 1.7, packBytes: 2_047_632 },
git: { firstByteMs: 195.26, doneMs: 216.9, packBytes: 9_435_458 }
}
] satisfies CloneCase[];
export const formatMs = (ms: number) => (ms < 1_000 ? `${ms} ms` : `${(ms / 1_000).toFixed(2)} s`);
export const formatBytes = (bytes: number) =>
bytes >= 2 ** 30 ? `${(bytes / 2 ** 30).toFixed(2)} GiB` : `${(bytes / 2 ** 20).toFixed(2)} MiB`;