Datasets:
File size: 27,819 Bytes
f3042bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | <!doctype html>
<html><head><meta charset="utf-8">
<title>Which interface wins, per grammar and model</title>
<style>
body { font-family: var(--font-sans, system-ui, sans-serif); color: var(--foreground, #0b0b0b); background: var(--background, #fcfcfb); margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
p.sub { font-size: 12.5px; color: var(--muted-foreground, #52514e); margin: 0 0 12px; line-height: 1.45; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 11.5px; color: var(--muted-foreground, #52514e); margin: 0 0 12px; }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -3px; margin-right: 5px; }
table.grid { border-collapse: separate; border-spacing: 2px; width: 100%; table-layout: fixed; font-variant-numeric: tabular-nums; }
.grid th { font-weight: 500; font-size: 11px; color: var(--muted-foreground, #52514e); padding: 0 0 2px; }
.grid th.variant { font-size: 11.5px; color: var(--foreground, #0b0b0b); line-height: 1.2; vertical-align: bottom; }
.grid col.sp { width: 4px; }
.grid td.sp, .grid th.sp { padding: 0; }
.grid td.c { height: 24px; border-radius: 3px; text-align: center; font-size: 10.5px; cursor: default; }
.grid td.c.best { font-weight: 700; }
.grid td.c:hover { outline: 2px solid var(--foreground, #0b0b0b); outline-offset: 1px; }
.grid td.m { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.grid td.nd { font-size: 11px; text-align: right; padding-right: 8px; color: var(--muted-foreground, #52514e); }
.grid tr.gram td { font-size: 12.5px; font-weight: 600; padding-top: 12px; }
.grid tr.sum td { font-size: 10.5px; text-align: center; color: var(--muted-foreground, #52514e); line-height: 1.25; }
.grid tr.sum td.lbl { text-align: left; white-space: nowrap; }
.grid tr.sum.first td { padding-top: 4px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted-foreground, #52514e); margin: 0 0 10px; }
.toggle .seg { display: inline-flex; border: 1px solid var(--border, #e1e0d9); border-radius: 6px; overflow: hidden; }
.toggle button { font: inherit; color: var(--foreground, #0b0b0b); background: transparent; border: 0; padding: 4px 10px; cursor: pointer; }
.toggle button + button { border-left: 1px solid var(--border, #e1e0d9); }
.toggle button[aria-pressed="true"] { background: var(--foreground, #0b0b0b); color: var(--background, #fcfcfb); }
.tip { position: fixed; pointer-events: none; background: var(--popover, #fff); color: var(--popover-foreground, #0b0b0b); border: 1px solid var(--border, #e1e0d9); border-radius: 6px; padding: 7px 9px; font-size: 11.5px; line-height: 1.45; box-shadow: 0 4px 14px rgba(0,0,0,.18); display: none; z-index: 10; max-width: 240px; }
details { margin-top: 12px; font-size: 12px; color: var(--muted-foreground, #52514e); }
details table { border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; }
details td, details th { padding: 2px 10px 2px 0; text-align: left; font-size: 11.5px; }
</style></head>
<body>
<h2>How far each interface falls short of the best, per grammar and model</h2>
<p class="sub">Each square is one interface on one grammar × model: its mean final quality below the best interface in that row. The strongest color is the best; the faintest is the furthest from it. ★ marks the best; ≈ means within 0.02 of it, which is noise at 8 tasks. Full-docs cells use the corrected docs. "No docs" is first-try quality with no grammar documentation. Time is mean wall-clock per chart, with model calls and host checks; it depends on provider load, and the full-docs cells ran on a later day.</p>
<div class="legend" id="legend"></div>
<div class="toggle"><span>Group columns by</span><span class="seg" role="group" aria-label="Group columns by"><button type="button" data-order="variant" aria-pressed="true">Docs and tools</button><button type="button" data-order="interface" aria-pressed="false">JSON or code</button></span></div>
<table class="grid" id="grid"></table>
<details><summary>Table view</summary><div id="tableview"></div></details>
<div class="tip" id="tip"></div>
<script>
const DATA = {"cells":[{"grammar":"vega-lite","model":"gpt-6-sol","noDocs":0.9816,"best":0.9869,"quality":{"json-complete":0.9659,"code-complete":0.9589,"json-complete-index":0.9681,"code-complete-index":0.9816,"json-complete-index-hints":0.978,"code-complete-index-hints":0.9707,"json-functions":0.9869,"code-functions":0.9742,"json-functions-index":0.9777,"code-functions-index":0.9726},"cost":{"json-complete":0.0283,"code-complete":0.0324,"json-complete-index":0.0148,"code-complete-index":0.0192,"json-complete-index-hints":0.014,"code-complete-index-hints":0.0176,"json-functions":0.2513,"code-functions":0.0358,"json-functions-index":0.1389,"code-functions-index":0.0449},"seconds":{"json-complete":10.1821,"code-complete":13.3467,"json-complete-index":15.7646,"code-complete-index":18.4091,"json-complete-index-hints":16.1609,"code-complete-index-hints":17.5005,"json-functions":97.1138,"code-functions":22.2807,"json-functions-index":92.9933,"code-functions-index":34.2528}},{"grammar":"vega-lite","model":"gpt-6-sol-low","noDocs":0.9846,"best":0.9881,"quality":{"json-complete":0.9502,"code-complete":0.9584,"json-complete-index":0.9676,"code-complete-index":0.9717,"json-complete-index-hints":0.9578,"code-complete-index-hints":0.9752,"json-functions":0.9881,"code-functions":0.9479,"json-functions-index":0.9678,"code-functions-index":0.9643},"cost":{"json-complete":0.0211,"code-complete":0.0215,"json-complete-index":0.0074,"code-complete-index":0.0081,"json-complete-index-hints":0.0079,"code-complete-index-hints":0.0081,"json-functions":0.2563,"code-functions":0.0239,"json-functions-index":0.0655,"code-functions-index":0.0194},"seconds":{"json-complete":5.0014,"code-complete":7.4144,"json-complete-index":6.496,"code-complete-index":7.2368,"json-complete-index-hints":6.8579,"code-complete-index-hints":6.7588,"json-functions":93.3213,"code-functions":9.6858,"json-functions-index":56.4207,"code-functions-index":12.5978}},{"grammar":"vega-lite","model":"claude-opus-5.5","noDocs":0.9519,"best":1,"quality":{"json-complete":1,"code-complete":0.997,"json-complete-index":1,"code-complete-index":0.997,"json-complete-index-hints":0.9958,"code-complete-index-hints":0.9936,"json-functions":0.9906,"code-functions":1,"json-functions-index":1,"code-functions-index":0.9901},"cost":{"json-complete":0.0479,"code-complete":0.0536,"json-complete-index":0.0354,"code-complete-index":0.0385,"json-complete-index-hints":0.0349,"code-complete-index-hints":0.0386,"json-functions":0.4559,"code-functions":0.0819,"json-functions-index":0.2745,"code-functions-index":0.0805},"seconds":{"json-complete":10.4549,"code-complete":11.3249,"json-complete-index":10.8574,"code-complete-index":11.8373,"json-complete-index-hints":10.8267,"code-complete-index-hints":12.461,"json-functions":33.2879,"code-functions":14.3307,"json-functions-index":41.6886,"code-functions-index":20.3841}},{"grammar":"vega-lite","model":"claude-opus-5.5-low","noDocs":1,"best":0.997,"quality":{"json-complete":0.997,"code-complete":0.997,"json-complete-index":0.997,"code-complete-index":0.994,"json-complete-index-hints":0.997,"code-complete-index-hints":0.997,"json-functions":0.997,"code-functions":0.9911,"json-functions-index":0.997,"code-functions-index":0.994},"cost":{"json-complete":0.0389,"code-complete":0.0395,"json-complete-index":0.0162,"code-complete-index":0.0163,"json-complete-index-hints":0.0159,"code-complete-index-hints":0.0165,"json-functions":0.3071,"code-functions":0.0435,"json-functions-index":0.1055,"code-functions-index":0.029},"seconds":{"json-complete":7.8905,"code-complete":7.9951,"json-complete-index":8.653,"code-complete-index":8.6515,"json-complete-index-hints":8.5654,"code-complete-index-hints":8.6468,"json-functions":20.5713,"code-functions":10.2736,"json-functions-index":21.9006,"code-functions-index":12.5705}},{"grammar":"vega-lite","model":"gemini-3.8-flash-medium","noDocs":0.5,"best":1,"quality":{"json-complete":1,"code-complete":0.9661,"json-complete-index":0.9881,"code-complete-index":0.9041,"json-complete-index-hints":0.9524,"code-complete-index-hints":0.9671,"json-functions":0.747,"code-functions":0.9419,"json-functions-index":0.625,"code-functions-index":0.9745},"cost":{"json-complete":0.0743,"code-complete":0.0672,"json-complete-index":0.047,"code-complete-index":0.0417,"json-complete-index-hints":0.075,"code-complete-index-hints":0.0424,"json-functions":0.5003,"code-functions":0.0602,"json-functions-index":0.28,"code-functions-index":0.1344},"seconds":{"json-complete":81.9133,"code-complete":66.7603,"json-complete-index":35.9835,"code-complete-index":29.8352,"json-complete-index-hints":52.0137,"code-complete-index-hints":30.9832,"json-functions":130.6747,"code-functions":39.3243,"json-functions-index":102.5321,"code-functions-index":76.2289}},{"grammar":"vega-lite","model":"deepseek-v4.1-flash","noDocs":0.808,"best":0.9777,"quality":{"json-complete":0.9423,"code-complete":0.9663,"json-complete-index":0.9122,"code-complete-index":0.9428,"json-complete-index-hints":0.9187,"code-complete-index-hints":0.9423,"json-functions":0.7723,"code-functions":0.8971,"json-functions-index":0.9573,"code-functions-index":0.9777},"cost":{"json-complete":0.0154,"code-complete":0.0114,"json-complete-index":0.0071,"code-complete-index":0.0074,"json-complete-index-hints":0.0057,"code-complete-index-hints":0.0098,"json-functions":0.0473,"code-functions":0.0215,"json-functions-index":0.0543,"code-functions-index":0.0199},"seconds":{"json-complete":19.5784,"code-complete":17.01,"json-complete-index":18.686,"code-complete-index":18.064,"json-complete-index-hints":12.5004,"code-complete-index-hints":21.5861,"json-functions":93.3559,"code-functions":30.5699,"json-functions-index":54.4424,"code-functions-index":33.3602}},{"grammar":"gosling","model":"gpt-6-sol","noDocs":0.5707,"best":0.7853,"quality":{"json-complete":0.7582,"code-complete":0.7311,"json-complete-index":0.7851,"code-complete-index":0.6557,"json-complete-index-hints":0.6543,"code-complete-index-hints":0.7184,"json-functions":0.7853,"code-functions":0.6332,"json-functions-index":0.6543,"code-functions-index":0.6311},"cost":{"json-complete":0.0135,"code-complete":0.0155,"json-complete-index":0.018,"code-complete-index":0.0215,"json-complete-index-hints":0.0155,"code-complete-index-hints":0.0188,"json-functions":0.0504,"code-functions":0.0165,"json-functions-index":0.0678,"code-functions-index":0.03},"seconds":{"json-complete":11.4569,"code-complete":12.0812,"json-complete-index":14.8695,"code-complete-index":16.4376,"json-complete-index-hints":11.3682,"code-complete-index-hints":13.5103,"json-functions":30.8226,"code-functions":12.6209,"json-functions-index":32.6121,"code-functions-index":18.7737}},{"grammar":"gosling","model":"gpt-6-sol-low","noDocs":0.6206,"best":0.7915,"quality":{"json-complete":0.7665,"code-complete":0.7915,"json-complete-index":0.7624,"code-complete-index":0.7165,"json-complete-index-hints":0.7124,"code-complete-index-hints":0.7082,"json-functions":0.5837,"code-functions":0.5522,"json-functions-index":0.7165,"code-functions-index":0.7249},"cost":{"json-complete":0.0075,"code-complete":0.0087,"json-complete-index":0.012,"code-complete-index":0.0117,"json-complete-index-hints":0.0105,"code-complete-index-hints":0.0107,"json-functions":0.0456,"code-functions":0.0093,"json-functions-index":0.0469,"code-functions-index":0.0178},"seconds":{"json-complete":5.7968,"code-complete":6.6579,"json-complete-index":10.7826,"code-complete-index":9.8527,"json-complete-index-hints":7.3721,"code-complete-index-hints":7.3949,"json-functions":23.8128,"code-functions":6.0045,"json-functions-index":22.5998,"code-functions-index":10.9405}},{"grammar":"gosling","model":"claude-opus-5.5","noDocs":0.7497,"best":0.842,"quality":{"json-complete":0.8374,"code-complete":0.8165,"json-complete-index":0.8353,"code-complete-index":0.8415,"json-complete-index-hints":0.8082,"code-complete-index-hints":0.8145,"json-functions":0.8214,"code-functions":0.842,"json-functions-index":0.8266,"code-functions-index":0.8082},"cost":{"json-complete":0.0302,"code-complete":0.03,"json-complete-index":0.0338,"code-complete-index":0.0303,"json-complete-index-hints":0.0559,"code-complete-index-hints":0.0582,"json-functions":0.1525,"code-functions":0.0367,"json-functions-index":0.1979,"code-functions-index":0.0627},"seconds":{"json-complete":10.6028,"code-complete":10.7274,"json-complete-index":13.7399,"code-complete-index":12.5631,"json-complete-index-hints":11.5107,"code-complete-index-hints":12.3616,"json-functions":30.0011,"code-functions":12.688,"json-functions-index":34.6746,"code-functions-index":16.6109}},{"grammar":"gosling","model":"claude-opus-5.5-low","noDocs":0.8186,"best":0.8395,"quality":{"json-complete":0.8061,"code-complete":0.7978,"json-complete-index":0.827,"code-complete-index":0.8061,"json-complete-index-hints":0.8395,"code-complete-index-hints":0.7874,"json-functions":0.7671,"code-functions":0.7267,"json-functions-index":0.7665,"code-functions-index":0.7188},"cost":{"json-complete":0.0176,"code-complete":0.0185,"json-complete-index":0.0155,"code-complete-index":0.0156,"json-complete-index-hints":0.0149,"code-complete-index-hints":0.0156,"json-functions":0.0722,"code-functions":0.0224,"json-functions-index":0.132,"code-functions-index":0.0409},"seconds":{"json-complete":6.515,"code-complete":6.911,"json-complete-index":8.293,"code-complete-index":8.3759,"json-complete-index-hints":7.3797,"code-complete-index-hints":7.8399,"json-functions":15.0119,"code-functions":9.9759,"json-functions-index":21.8924,"code-functions-index":11.6227}},{"grammar":"gosling","model":"gemini-3.8-flash-medium","noDocs":0.7145,"best":0.8249,"quality":{"json-complete":0.7545,"code-complete":0.7666,"json-complete-index":0.8249,"code-complete-index":0.794,"json-complete-index-hints":0.7703,"code-complete-index-hints":0.7875,"json-functions":0.7409,"code-functions":0.4393,"json-functions-index":0.5641,"code-functions-index":0.5085},"cost":{"json-complete":0.0531,"code-complete":0.0522,"json-complete-index":0.0521,"code-complete-index":0.0397,"json-complete-index-hints":0.054,"code-complete-index-hints":0.0367,"json-functions":0.1157,"code-functions":0.0432,"json-functions-index":0.191,"code-functions-index":0.0851},"seconds":{"json-complete":88.8064,"code-complete":93.3303,"json-complete-index":40.9203,"code-complete-index":28.4826,"json-complete-index-hints":41.3423,"code-complete-index-hints":27.289,"json-functions":56.9483,"code-functions":19.7867,"json-functions-index":77.2545,"code-functions-index":49.251}},{"grammar":"gosling","model":"deepseek-v4.1-flash","noDocs":0.1685,"best":0.783,"quality":{"json-complete":0.6375,"code-complete":0.6251,"json-complete-index":0.783,"code-complete-index":0.6774,"json-complete-index-hints":0.6084,"code-complete-index-hints":0.7122,"json-functions":0.6441,"code-functions":0.4949,"json-functions-index":0.5611,"code-functions-index":0.4289},"cost":{"json-complete":0.0079,"code-complete":0.0099,"json-complete-index":0.012,"code-complete-index":0.0176,"json-complete-index-hints":0.012,"code-complete-index-hints":0.0151,"json-functions":0.0399,"code-functions":0.0117,"json-functions-index":0.0475,"code-functions-index":0.0116},"seconds":{"json-complete":18.1612,"code-complete":24.0592,"json-complete-index":34.0587,"code-complete-index":47.3419,"json-complete-index-hints":30.1923,"code-complete-index-hints":33.4704,"json-functions":46.4825,"code-functions":26.2546,"json-functions-index":62.1427,"code-functions-index":23.361}},{"grammar":"genomespy","model":"gpt-6-sol","noDocs":0,"best":0.94,"quality":{"json-complete":0.7979,"code-complete":0.7803,"json-complete-index":0.4718,"code-complete-index":0.44,"json-complete-index-hints":0.7969,"code-complete-index-hints":0.7707,"json-functions":0.94,"code-functions":0.8606,"json-functions-index":0.88,"code-functions-index":0.8941},"cost":{"json-complete":0.0385,"code-complete":0.0443,"json-complete-index":0.0503,"code-complete-index":0.0458,"json-complete-index-hints":0.0243,"code-complete-index-hints":0.0262,"json-functions":0.3572,"code-functions":0.0438,"json-functions-index":0.2103,"code-functions-index":0.0585},"seconds":{"json-complete":15.552,"code-complete":16.1636,"json-complete-index":21.1665,"code-complete-index":20.0159,"json-complete-index-hints":15.4355,"code-complete-index-hints":15.4713,"json-functions":116.3144,"code-functions":20.5212,"json-functions-index":94.1884,"code-functions-index":30.9509}},{"grammar":"genomespy","model":"gpt-6-sol-low","noDocs":0.0516,"best":0.899,"quality":{"json-complete":0.7559,"code-complete":0.7417,"json-complete-index":0.6635,"code-complete-index":0.5672,"json-complete-index-hints":0.7775,"code-complete-index-hints":0.7451,"json-functions":0.899,"code-functions":0.7948,"json-functions-index":0.8802,"code-functions-index":0.8278},"cost":{"json-complete":0.025,"code-complete":0.0219,"json-complete-index":0.0359,"code-complete-index":0.0397,"json-complete-index-hints":0.0205,"code-complete-index-hints":0.0176,"json-functions":0.2819,"code-functions":0.032,"json-functions-index":0.1458,"code-functions-index":0.0278},"seconds":{"json-complete":7.684,"code-complete":7.9774,"json-complete-index":13.9008,"code-complete-index":12.2677,"json-complete-index-hints":8.3839,"code-complete-index-hints":7.9329,"json-functions":82.2439,"code-functions":8.8213,"json-functions-index":66.8565,"code-functions-index":12.6536}},{"grammar":"genomespy","model":"claude-opus-5.5","noDocs":0.6774,"best":0.978,"quality":{"json-complete":0.9661,"code-complete":0.9741,"json-complete-index":0.9144,"code-complete-index":0.8927,"json-complete-index-hints":0.978,"code-complete-index-hints":0.9632,"json-functions":0.962,"code-functions":0.952,"json-functions-index":0.9745,"code-functions-index":0.9474},"cost":{"json-complete":0.0523,"code-complete":0.0536,"json-complete-index":0.0456,"code-complete-index":0.0435,"json-complete-index-hints":0.0715,"code-complete-index-hints":0.0707,"json-functions":0.6029,"code-functions":0.107,"json-functions-index":0.4632,"code-functions-index":0.0921},"seconds":{"json-complete":11.0935,"code-complete":12.7095,"json-complete-index":18.3135,"code-complete-index":17.1664,"json-complete-index-hints":15.7362,"code-complete-index-hints":13.9644,"json-functions":34.584,"code-functions":17.5819,"json-functions-index":44.8276,"code-functions-index":20.0495}},{"grammar":"genomespy","model":"claude-opus-5.5-low","noDocs":0.6331,"best":0.9931,"quality":{"json-complete":0.9931,"code-complete":0.9537,"json-complete-index":0.9334,"code-complete-index":0.9249,"json-complete-index-hints":0.9451,"code-complete-index-hints":0.9931,"json-functions":0.9889,"code-functions":0.9931,"json-functions-index":0.9931,"code-functions-index":0.9597},"cost":{"json-complete":0.0417,"code-complete":0.0402,"json-complete-index":0.0259,"code-complete-index":0.0251,"json-complete-index-hints":0.0234,"code-complete-index-hints":0.021,"json-functions":0.3018,"code-functions":0.0659,"json-functions-index":0.3222,"code-functions-index":0.0487},"seconds":{"json-complete":7.026,"code-complete":7.2814,"json-complete-index":11.7594,"code-complete-index":12.3451,"json-complete-index-hints":11.4872,"code-complete-index-hints":10.4025,"json-functions":20.7241,"code-functions":10.7127,"json-functions-index":30.3543,"code-functions-index":11.7609}},{"grammar":"genomespy","model":"gemini-3.8-flash-medium","noDocs":0.0396,"best":0.9588,"quality":{"json-complete":0.8919,"code-complete":0.9308,"json-complete-index":0.7287,"code-complete-index":0.7789,"json-complete-index-hints":0.8648,"code-complete-index-hints":0.9588,"json-functions":0.7137,"code-functions":0.9402,"json-functions-index":0.4625,"code-functions-index":0.815},"cost":{"json-complete":0.1768,"code-complete":0.1263,"json-complete-index":0.1425,"code-complete-index":0.076,"json-complete-index-hints":0.159,"code-complete-index-hints":0.0815,"json-functions":0.5426,"code-functions":0.0889,"json-functions-index":0.3262,"code-functions-index":0.1562},"seconds":{"json-complete":229.922,"code-complete":119.8226,"json-complete-index":127.7977,"code-complete-index":60.907,"json-complete-index-hints":134.5128,"code-complete-index-hints":62.2174,"json-functions":142.1865,"code-functions":57.6173,"json-functions-index":141.8951,"code-functions-index":92.2881}},{"grammar":"genomespy","model":"deepseek-v4.1-flash","noDocs":0,"best":0.896,"quality":{"json-complete":0.8279,"code-complete":0.7972,"json-complete-index":0.6263,"code-complete-index":0.6158,"json-complete-index-hints":0.7972,"code-complete-index-hints":0.896,"json-functions":0.8263,"code-functions":0.8271,"json-functions-index":0.7237,"code-functions-index":0.7667},"cost":{"json-complete":0.0218,"code-complete":0.0176,"json-complete-index":0.0454,"code-complete-index":0.0619,"json-complete-index-hints":0.0174,"code-complete-index-hints":0.0202,"json-functions":0.0594,"code-functions":0.0334,"json-functions-index":0.0892,"code-functions-index":0.0339},"seconds":{"json-complete":40.1007,"code-complete":37.3396,"json-complete-index":93.5864,"code-complete-index":123.924,"json-complete-index-hints":44.1876,"code-complete-index-hints":52.9435,"json-functions":104.4293,"code-functions":58.4406,"json-functions-index":90.874,"code-functions-index":58.2073}}]};
const VARIANTS = [
['complete', 'Full docs'],
['complete-index', 'Index'],
['complete-index-hints', 'Index + hints'],
['functions', 'Constructors'],
['functions-index', 'Constructors + index'],
];
const INTERFACES = [
['json', 'JSON'],
['code', 'Code'],
];
// Which level heads the column groups: 'variant' (docs and tools) or 'interface'.
let order = 'variant';
function blocks() {
const [outer, inner] = order === 'variant' ? [VARIANTS, INTERFACES] : [INTERFACES, VARIANTS];
return outer.map(([o, name]) => ({
name,
columns: inner.map(([i, label]) => ({ label, group: order === 'variant' ? `${i}-${o}` : `${o}-${i}` })),
}));
}
const BINS = [0.02, 0.05, 0.10, 0.20];
const LABELS = ['≤ 0.02 (≈, ★ best)', '0.02–0.05', '0.05–0.10', '0.10–0.20', '> 0.20'];
// Strongest contrast with the surface = best. Validated as ordinal ramps
// against #fcfcfb (light) and #1a1a19 (dark).
const RAMP = {
light: { fill: ['#0d366b', '#1c5cab', '#2a78d6', '#5598e7', '#86b6ef'], ink: ['#ffffff', '#ffffff', '#ffffff', '#0b0b0b', '#0b0b0b'] },
dark: { fill: ['#b7d3f6', '#6da7ec', '#3987e5', '#256abf', '#184f95'], ink: ['#0b0b0b', '#0b0b0b', '#0b0b0b', '#f0efec', '#f0efec'] },
};
const GRAMMAR = { 'vega-lite': 'Vega-Lite', gosling: 'Gosling', genomespy: 'GenomeSpy' };
const short = (m) => m.replace('-medium', '').replace('deepseek-v4.1-flash', 'deepseek-v4.1');
const f2 = (v) => v.toFixed(2).replace(/^0/, '');
const usd = (v) => '$' + v.toFixed(3).replace(/^0/, '');
const secs = (v) => `${Math.round(v)} s`;
const bin = (s) => BINS.findIndex((edge) => s <= edge + 1e-9) === -1 ? BINS.length : BINS.findIndex((edge) => s <= edge + 1e-9);
function isDark() {
const canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
const context = canvas.getContext('2d');
context.fillStyle = getComputedStyle(document.body).backgroundColor || '#fcfcfb';
context.fillRect(0, 0, 1, 1);
const [r, g, b] = context.getImageData(0, 0, 1, 1).data;
return 0.2126 * r + 0.7152 * g + 0.0722 * b < 128;
}
const mean = (values) => values.reduce((a, b) => a + b, 0) / values.length;
function summaryRows(cells) {
const row = (name, value, cls) =>
`<tr class="sum${cls}"><td class="lbl" colspan="2">${name}</td>` +
blocks().map((block, i) => (i ? '<td class="sp"></td>' : '') +
block.columns.map(({ group }) => `<td>${value(group)}</td>`).join('')).join('') + '</tr>';
return row('avg time per chart', (g) => secs(mean(cells.map((c) => c.seconds[g]))), ' first') +
row('avg cost per chart', (g) => usd(mean(cells.map((c) => c.cost[g]))), '');
}
function render() {
const ramp = RAMP[isDark() ? 'dark' : 'light'];
document.getElementById('legend').innerHTML = '<span>Below best:</span>' +
LABELS.map((l, i) => `<span><span class="sw" style="background:${ramp.fill[i]}"></span>${l}</span>`).join('');
const layout = blocks();
const groups = layout.flatMap((block) => block.columns.map(({ group }) => group));
let h = '<colgroup><col style="width:112px"><col style="width:40px">' +
layout.map((block, i) => (i ? '<col class="sp">' : '') + block.columns.map(() => '<col>').join('')).join('') +
'</colgroup><thead><tr><th></th><th></th>' +
layout.map((block, i) => (i ? '<th class="sp"></th>' : '') + `<th class="variant" colspan="${block.columns.length}">${block.name}</th>`).join('') +
'</tr><tr><th style="text-align:left">Model</th><th style="text-align:right;padding-right:8px">No docs</th>' +
layout.map((block, i) => (i ? '<th class="sp"></th>' : '') + block.columns.map(({ label }) => `<th>${label}</th>`).join('')).join('') +
'</tr></thead><tbody>';
for (const grammar of Object.keys(GRAMMAR)) {
const cells = DATA.cells.filter((c) => c.grammar === grammar);
h += `<tr class="gram"><td colspan="2">${GRAMMAR[grammar]}</td></tr>`;
for (const c of cells) {
h += `<tr><td class="m" title="${c.model}">${short(c.model)}</td><td class="nd">${f2(c.noDocs)}</td>`;
layout.forEach((block, i) => {
if (i) h += '<td class="sp"></td>';
for (const { group } of block.columns) {
const s = c.best - c.quality[group];
const b = bin(s);
const isBest = s < 1e-9;
h += `<td class="c${isBest ? ' best' : ''}" style="background:${ramp.fill[b]};color:${ramp.ink[b]}" data-g="${group}" data-m="${c.model}" data-r="${grammar}" data-q="${c.quality[group]}" data-s="${s}" data-cost="${c.cost[group]}" data-t="${c.seconds[group]}">${isBest ? '★' : b === 0 ? '≈' : '−' + f2(s)}</td>`;
}
});
h += '</tr>';
}
h += summaryRows(cells);
}
h += '<tr class="gram"><td colspan="2">All grammars</td></tr>' + summaryRows(DATA.cells) + '</tbody>';
document.getElementById('grid').innerHTML = h;
document.getElementById('tableview').innerHTML = '<table><tr><th>Grammar</th><th>Model</th>' +
groups.map((g) => `<th>${g}</th>`).join('') + '</tr>' +
DATA.cells.map((c) => `<tr><td>${GRAMMAR[c.grammar]}</td><td>${c.model}</td>` +
groups.map((g) => `<td>${c.quality[g].toFixed(3)}</td>`).join('') + '</tr>').join('') + '</table>';
}
render();
for (const button of document.querySelectorAll('.toggle button')) {
button.addEventListener('click', () => {
order = button.dataset.order;
for (const other of document.querySelectorAll('.toggle button')) other.setAttribute('aria-pressed', String(other === button));
render();
});
}
new MutationObserver(render).observe(document.documentElement, { attributes: true });
const tip = document.getElementById('tip');
document.addEventListener('mousemove', (e) => {
const td = e.target.closest && e.target.closest('td.c');
if (!td) { tip.style.display = 'none'; return; }
const s = +td.dataset.s;
tip.innerHTML = `<b>${td.dataset.g}</b><br>${GRAMMAR[td.dataset.r]} · ${td.dataset.m}<br>Quality ${(+td.dataset.q).toFixed(3)}${s < 1e-9 ? ' (best)' : `, ${s.toFixed(3)} below best`}<br>Cost ${usd(+td.dataset.cost)}, time ${secs(+td.dataset.t)} per chart`;
tip.style.display = 'block';
tip.style.left = Math.min(e.clientX + 12, window.innerWidth - tip.offsetWidth - 4) + 'px';
tip.style.top = e.clientY + 12 + 'px';
});
</script>
</body></html>
|