-
Notifications
You must be signed in to change notification settings - Fork 5
/
datasets-table.js
51 lines (46 loc) · 1.67 KB
/
datasets-table.js
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
const fs = require("node:fs")
const json = JSON.parse(fs.readFileSync("results/dataset_stats.json", "utf8"))
function statsFor(name, type, repeats, num_authors) {
let data = json[name]
if (!num_authors) num_authors = data.num_agents
return [
name,
type,
repeats,
Math.round(data.total_keystrokes / 1000), // total events (k)
// Other columns:
// (100 * data.num_insert_keystrokes / data.total_keystrokes).toFixed(1), // % insert events
// Math.round(data.num_insert_keystrokes / 1000), // number of insert events
// Math.round(data.num_delete_keystrokes / 1000), // number of delete events
data.concurrency_estimate.toFixed(2), // concurrency estimate
data.graph_rle_size, // number of nodes in the causal graph
num_authors,
(100 * data.final_doc_len_chars / data.num_insert_keystrokes).toFixed(1),
// (data.op_stats.len / 1000).toFixed(1),
(data.final_doc_len_utf8 / 1024).toFixed(1)
].join(" & ") + " \\\\"
}
const table = [
"% generated by stats-table.js",
"\\begin{tabular}{ccrrrrrrr}",
"\\toprule",
"\\textbf{Name} &",
"\\textbf{Type} &",
"\\textbf{Repeats} &",
"\\textbf{Events (k)} &",
"\\textbf{Avg Concurrency} &",
"\\textbf{Graph runs} &",
"\\textbf{Authors} &",
"\\textbf{Chars remaining (\\%)} &",
"\\textbf{Final size (kB)} \\\\\\midrule",
statsFor("S1", "sequential", 3, 2),
statsFor("S2", "sequential", 3),
statsFor("S3", "sequential", 1, 2),
statsFor("C1", "concurrent", 25),
statsFor("C2", "concurrent", 25, 2),
statsFor("A1", "asynchronous", 1),
statsFor("A2", "asynchronous", 2),
"\\bottomrule",
"\\end{tabular}"
].join("\n")
fs.writeFileSync("results/dataset_stats.tex", table)