99 | | Date | ${datetimeFormat(t.run.date)} |
100 | | Rev | ${t.run.branch} @ ${link(t.run.url, t.run.shortrev)} |
101 | | Suite | ${link(t.suite.url, t.suite.name)} |
102 | | Test | ${t.data.name} |
103 | | n | ${t.data.times.length} |
104 | | avg | ${t.avg_time()} |
105 |
106 | `;
107 | }
108 | });
109 |
110 |
111 | // Add the X Axis
112 | svg
113 | .append("g")
114 | .attr("transform", `translate(0, ${height})`)
115 | .call(d3.axisBottom(x));
116 |
117 | // Add the Y Axis
118 | svg.append("g").call(d3.axisLeft(y));
119 |
120 | // svg
121 | // .selectAll(".text")
122 | // .data(data)
123 | // .enter()
124 | // .append("text") // Uses the enter().append() method
125 | // .attr("class", "label") // Assign a class for styling
126 | // .attr("x", d => x(d.run.date))
127 | // .attr("y", d => y(d.data.times[0]))
128 | // .attr("dy", "-5")
129 | // .text(() => "label");
130 |
131 | }
132 |
133 | class Run {
134 | constructor(dirname) {
135 | let match = DIR_REGEX.exec(dirname);
136 | this.path = DATA_DIR + dirname + "/";
137 | this.name = dirname;
138 | this.date = new Date(match[1]);
139 | this.branch = match[2];
140 | this.describe = match[3];
141 | this.tag = match[4];
142 | this.commitsAhead = +match[5];
143 | this.rev = match[6];
144 | this.dirty = !!match[7];
145 |
146 | this.suites = null;
147 | this.url = `${REPO}/tree/${this.rev}`;
148 | this.shortrev = this.rev.slice(0,7)
149 | }
150 |
151 | async load(depth = 1) {
152 | let suites = await get(this.path);
153 | this.suites = await Promise.all(
154 | suites
155 | .filter(s => s.type == "directory")
156 | .map(async s => {
157 | let suite = new Suite(this, s.name);
158 | if (depth > 0) {
159 | await suite.load(depth - 1);
160 | }
161 | return suite;
162 | })
163 | );
164 | return this;
165 | }
166 | }
167 |
168 | class Suite {
169 | constructor(run, name) {
170 | this.run = run;
171 | this.name = name;
172 | this.path = run.path + name + "/";
173 |
174 | this.tests = null;
175 | this.url = `${REPO}/blob/${run.rev}/tests/${name}.rs`;
176 | }
177 |
178 | async load(depth = 0) {
179 | let tests = await get(this.path);
180 | this.tests = await Promise.all(
181 | tests
182 | .filter(t => t.type == "file")
183 | .map(async t => {
184 | let test = new Test(this.run, this, t.name);
185 | if (depth > 0) {
186 | await test.load();
187 | }
188 | return test;
189 | })
190 | );
191 | return this;
192 | }
193 | }
194 |
195 | class Test {
196 | constructor(run, suite, name) {
197 | this.run = run;
198 | this.suite = suite;
199 | this.name = name;
200 | this.path = suite.path + name;
201 | this.data = null;
202 | }
203 |
204 | async load() {
205 | this.data = await get(this.path);
206 | }
207 |
208 | avg_time() {
209 | var total = 0;
210 | for (let t of this.data.times) total += t;
211 | return total / this.data.times.length;
212 | }
213 | }
214 |
215 | async function fetchRuns() {
216 | let runsListing = await d3.json(DATA_DIR);
217 | console.log("Got the listing", runsListing);
218 | let runs = runsListing
219 | .filter(i => i.type == "directory")
220 | .map(i => new Run(i.name));
221 | console.log("Runs: ", runs);
222 | return runs;
223 | }
224 |
225 | let RUNS = null;
226 |
227 | async function init() {
228 | let runs = await fetchRuns();
229 | RUNS = runs;
230 |
231 | runList
232 | .data(runs)
233 | .join("li")
234 | .text(run => `${run.branch} ${datetimeFormat(run.date)}`);
235 |
236 | updatePlot(runs);
237 | }
238 |
239 | init()
240 | .then(() => console.log("Successful init"))
241 | .catch(e => console.error("Failed init", e));
242 |
--------------------------------------------------------------------------------
/src/eggstentions/reconstruct.rs:
--------------------------------------------------------------------------------
1 | use std::collections::{HashMap, HashSet};
2 |
3 | use crate::{EGraph, Id, Language, SymbolLang, RecExpr, EClass, ColorId};
4 | use indexmap::IndexMap;
5 | use itertools::Itertools;
6 | use crate::eggstentions::tree::Tree;
7 |
8 | /// Reconstructs a RecExpr from an eclass.
9 | pub fn reconstruct(graph: &EGraph