The best way to control Claude Code, Codex and more from any computer or phone

main
astro 253 lines 6.25 KB
Raw
1 ---
2 /**
3 * `<VendorGrid />` — distilled against each official SDK, one column per
4 * vendor and one row per metric. Each cell has two bars scaled to that cell.
5 * Numbers are medians from benchmark run f6019b376 (AWS: 6 calls; Cloudflare
6 * and GCP: 1 call each), default mode.
7 */
8 type Cell = [official: number, distilled: number] | null;
9 const VENDORS = [
10 { name: "AWS SDK v3", sub: "6 calls" },
11 { name: "cloudflare", sub: "workers.scripts.list" },
12 { name: "@google-cloud/storage", sub: "getBuckets" },
13 ];
14 const METRICS: { label: string; fmt: (n: number) => string; cells: Cell[] }[] = [
15 {
16 label: "Bundle size",
17 fmt: (n) => `${(n / 1000).toFixed(1)} KB`,
18 cells: [
19 [143056, 55070],
20 [124466, 55816],
21 [239117, 39726],
22 ],
23 },
24 {
25 label: "Added latency",
26 fmt: (n) => `${n.toFixed(1)} µs`,
27 cells: [
28 [90.24, 15.68],
29 [15.51, 3.03],
30 [673.89, 6.19],
31 ],
32 },
33 {
34 label: "Import memory",
35 fmt: (n) => `${(n / 1e6).toFixed(2)} MB`,
36 cells: [
37 [3412520, 1033900],
38 [15314936, 651608],
39 [5142216, 689032],
40 ],
41 },
42 {
43 // Import + client setup + first call in a fresh process, bundled with
44 // rolldown (the bench's settings) as Alchemy deploys to Lambda/Workers.
45 // Median of 11 alternating runs on distilled main 8510122a3, mocked
46 // responses; AWS is the median over its 6 calls. Separate local harness,
47 // not part of benches/sdks yet.
48 label: "Cold start",
49 fmt: (n) => `${n.toFixed(1)} ms`,
50 cells: [
51 [33.6, 16.8],
52 [48.9, 16.3],
53 [21.0, 18.2],
54 ],
55 },
56 ];
57 const WORD: Record<string, [string, string]> = {
58 "Bundle size": ["smaller", "bigger"],
59 "Added latency": ["faster", "slower"],
60 "Import memory": ["less", "more"],
61 "Cold start": ["faster", "slower"],
62 };
63 const ratio = ([o, d]: [number, number]) => `${(d <= o ? o / d : d / o).toFixed(1)}×`;
64 ---
65
66 <figure class="vg not-content" aria-label="Distilled compared with the official AWS, Cloudflare and GCP SDKs">
67 <figcaption class="vg-title">Distilled vs the official SDKs</figcaption>
68 <div class="vg-legend">
69 <span><i class="o"></i>official SDK</span>
70 <span><i class="d"></i>distilled</span>
71 </div>
72 <div class="vg-grid">
73 <span></span>
74 {
75 VENDORS.map((v) => (
76 <div class="vg-vh">
77 <b>{v.name}</b>
78 <span>{v.sub}</span>
79 </div>
80 ))
81 }
82 {
83 METRICS.map((m) => (
84 <Fragment>
85 <div class="vg-mh">{m.label}</div>
86 {m.cells.map((c, vi) => {
87 if (!c)
88 return (
89 <div class="vg-cell na">
90 <span class="vg-mh-mobile">{m.label}</span>
91 <span class="vg-na">not measured yet</span>
92 </div>
93 );
94 const max = Math.max(...c);
95 const win = c[1] <= c[0];
96 return (
97 <div class={`vg-cell ${win ? "win" : "lose"}`} title={`${VENDORS[vi]!.name}: ${m.fmt(c[0])} · distilled: ${m.fmt(c[1])}`}>
98 <span class="vg-mh-mobile">{m.label}</span>
99 <span class="vg-big">{ratio(c)}</span>
100 <span class="vg-word">{WORD[m.label]![win ? 0 : 1]}</span>
101 <span class="vg-mini">
102 <i class="o" style={`width:${(100 * c[0]) / max}%`} />
103 <i class="d" style={`width:${Math.max(3, (100 * c[1]) / max)}%`} />
104 </span>
105 </div>
106 );
107 })}
108 </Fragment>
109 ))
110 }
111 </div>
112 <p class="vg-cap">
113 Distilled compared with each official SDK, same call on both sides. Hover a cell for the numbers. Cold start is import
114 plus the first call in a fresh process, bundled as deployed.
115 </p>
116 </figure>
117
118 <style is:global>
119 .vg {
120 margin: 2rem 0;
121 padding: 14px 16px 10px;
122 font: 14px/1.4 var(--alc-font-sans);
123 color: var(--alc-fg-1);
124 background: var(--alc-bg-elev-1);
125 border: 1px solid var(--alc-hairline-2);
126 border-radius: 12px;
127 }
128 .vg * {
129 box-sizing: border-box;
130 }
131 .vg-title {
132 font-weight: 700;
133 font-size: 1.05rem;
134 }
135 .vg-legend {
136 display: flex;
137 gap: 14px;
138 margin: 4px 0 10px;
139 font: 12px var(--alc-font-mono);
140 color: var(--alc-fg-3);
141 }
142 .vg-legend i,
143 .vg-legend i {
144 display: inline-block;
145 border-radius: 3px;
146 width: 10px;
147 height: 10px;
148 margin-right: 6px;
149 vertical-align: -1px;
150 }
151 .vg i.o {
152 background: var(--alc-terracotta);
153 }
154 .vg i.d {
155 background: var(--alc-accent);
156 }
157 .vg-grid {
158 display: grid;
159 grid-template-columns: 7.5em repeat(3, minmax(0, 1fr));
160 gap: 10px 14px;
161 align-items: center;
162 }
163 .vg-vh b {
164 display: block;
165 font: 600 12.5px var(--alc-font-mono);
166 }
167 .vg-vh span {
168 font-size: 11px;
169 color: var(--alc-fg-4);
170 }
171 .vg-mh {
172 font-weight: 600;
173 font-size: 13px;
174 }
175 .vg-mh-mobile {
176 display: none;
177 }
178 .vg-cell {
179 display: grid;
180 grid-template-columns: auto 1fr;
181 align-items: baseline;
182 gap: 0 6px;
183 padding-top: 8px;
184 border-top: 1px solid var(--alc-hairline-2);
185 cursor: default;
186 }
187 .vg-big {
188 font: 700 22px/1.1 var(--alc-font-mono);
189 }
190 .vg-word {
191 font-size: 12.5px;
192 color: var(--alc-fg-3);
193 }
194 .vg-cell.win .vg-big {
195 color: var(--alc-accent-text);
196 }
197 .vg-cell.lose .vg-big {
198 color: var(--alc-danger);
199 }
200 .vg-na {
201 grid-column: 1 / -1;
202 font-size: 12px;
203 font-style: italic;
204 color: var(--alc-fg-4);
205 }
206 .vg-mini {
207 grid-column: 1 / -1;
208 display: grid;
209 gap: 2px;
210 margin-top: 5px;
211 }
212 .vg-mini i {
213 display: block;
214 height: 4px;
215 border-radius: 2px;
216 }
217 .vg-cap {
218 margin: 10px 0 0;
219 font-size: 12px;
220 color: var(--alc-fg-4);
221 }
222 /* Narrow: keep the three vendor columns; metric names become row headers. */
223 @media (max-width: 620px) {
224 .vg-grid {
225 grid-template-columns: repeat(3, minmax(0, 1fr));
226 gap: 6px 10px;
227 }
228 .vg-grid > span:first-child {
229 display: none;
230 }
231 .vg-vh b {
232 font-size: 11px;
233 overflow-wrap: anywhere;
234 }
235 .vg-vh span {
236 display: none;
237 }
238 .vg-mh {
239 grid-column: 1 / -1;
240 margin-top: 4px;
241 font-size: 12.5px;
242 }
243 .vg-mh-mobile {
244 display: none;
245 }
246 .vg-big {
247 font-size: 17px;
248 }
249 .vg-word {
250 font-size: 11px;
251 }
252 }
253 </style>