Skip to content

Commit 50aec3b

Browse files
committed
cmd/tools/fast: tighten benchmark table layout
1 parent b629b5e commit 50aec3b

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

cmd/tools/fast/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ export-and-push is their replacement.)
160160
|-------------|----------------------------------|----------------------------------|
161161
| `v -o v.c` | `vprod -o v.c cmd/v` | self-compile to C |
162162
| `v -o v` | `vprod -o v cmd/v` | self-compile to a binary |
163+
| `V lines / s` | derived | V lines per second (`v -o v.c`) |
164+
| `V lines` | `-stats` | number of V source lines |
163165
| `v hello.v` | `vprod examples/hello_world.v` | compile a tiny program |
164166
| `v.c size` || size of the generated `v.c` |
165167
| scan/parse/check/cgen | `-show-timings` | per-stage compiler times (min) |
166-
| V lines | `-stats` | number of V source lines |
167-
| lines/s | derived | V lines per second (`v -o v.c`) |
168168

169169
Wall-clock timings take `max_samples` measurements after a couple of warmups and
170170
discard the slowest ones to cut noise (see the constants in `fast.v`).

cmd/tools/fast/fast.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ fn git(dir string, subcmd string) string {
6262
return lexec('git -C ${os.quoted_path(dir)} ${subcmd}')
6363
}
6464

65-
// short_hash abbreviates a commit hash for display, without panicking on the
66-
// 7-char hashes that `import` accepts (a plain `[..8]` slice would).
65+
// short_hash abbreviates a commit hash to 6 characters for display, without
66+
// panicking on shorter hashes that `import` accepts.
6767
fn short_hash(h string) string {
68-
return if h.len > 8 { h[..8] } else { h }
68+
return if h.len > 6 { h[..6] } else { h }
6969
}
7070

7171
// exe_name returns the platform-specific executable file name (V and its

cmd/tools/fast/models.v

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ struct Delta {
414414
// here in V (server side), so the template and the browser stay dumb.
415415
struct Row {
416416
mut:
417-
num int
418417
timestamp string
419418
commit_hash string
420419
commit_url string
@@ -461,9 +460,8 @@ fn build_rows(list []Benchmark) []Row {
461460
// the list is newest-first, so the older commit is the next element
462461
prev := if i + 1 < list.len { list[i + 1] } else { b }
463462
rows << Row{
464-
num: list.len - i
465-
timestamp: b.commit_date.format()
466-
commit_hash: b.commit_hash
463+
timestamp: b.commit_date.custom_format('MMM D HH:mm')
464+
commit_hash: short_hash(b.commit_hash)
467465
commit_url: 'https://github.com/vlang/v/commit/${b.commit_hash}'
468466
message: b.message
469467
v_c: b.v_c_ms

cmd/tools/fast/templates/index.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
}
7979
th.left, td.left { text-align: left; }
8080
tbody tr:hover { background: #1c202b; }
81-
td.num { color: var(--muted); font-size: 11px; }
82-
td.msg { max-width: 460px; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
81+
td.msg { max-width: 368px; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
8382
td.commit a { color: var(--accent); text-decoration: none; }
8483
.cell { position: relative; }
8584
.diff {
@@ -135,24 +134,22 @@ <h2 id="chart-title">Self-compilation time (ms), oldest → newest</h2>
135134
<div class="tablewrap">
136135
<table>
137136
<tr>
138-
<th></th>
139137
<th class="left">Timestamp</th>
140138
<th class="left">Commit</th>
141139
<th class="left">Message</th>
142140
<th>v -o v.c</th>
143141
<th>v -o v</th>
142+
<th>V lines / s</th>
143+
<th>V lines</th>
144144
<th>v hello.v</th>
145145
<th>v.c size</th>
146146
<th>scan</th>
147147
<th>parse</th>
148148
<th>check</th>
149149
<th>cgen</th>
150-
<th>V lines</th>
151-
<th>lines/s</th>
152150
</tr>
153151
@for row in rows
154152
<tr>
155-
<td class="num">${row.num}</td>
156153
<td class="left">${row.timestamp}</td>
157154
<td class="left commit"><a href="${row.commit_url}" target="_blank">${row.commit_hash}</a></td>
158155
<td class="left msg" title="${row.message}">${row.message}</td>
@@ -166,6 +163,8 @@ <h2 id="chart-title">Self-compilation time (ms), oldest → newest</h2>
166163
<span class="diff ${row.d_v_self.cls}">${row.d_v_self.text}</span>
167164
@end
168165
</td>
166+
<td>${row.lines_per_s}</td>
167+
<td>${row.vlines}</td>
169168
<td class="cell">${row.hello}ms
170169
@if row.d_hello.text != ''
171170
<span class="diff ${row.d_hello.cls}">${row.d_hello.text}</span>
@@ -176,8 +175,6 @@ <h2 id="chart-title">Self-compilation time (ms), oldest → newest</h2>
176175
<td>${row.parse}ms</td>
177176
<td>${row.check}ms</td>
178177
<td>${row.cgen}ms</td>
179-
<td>${row.vlines}</td>
180-
<td>${row.lines_per_s}</td>
181178
</tr>
182179
@end
183180
</table>

0 commit comments

Comments
 (0)