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
|
# File 'lib/optimize/demo/runner.rb', line 13
def run(sidecar_path:, output_dir:, bench_warmup: 2, bench_time: 5)
wt = Walkthrough.load(sidecar_path)
stem = File.basename(sidecar_path, ".walkthrough.yml")
source = File.read(wt.fixture_path)
snapshots = IseqSnapshots.generate(
fixture_path: wt.fixture_path,
walkthrough: wt.walkthrough,
entry_setup: wt.entry_setup,
entry_call: wt.entry_call,
)
bench = Benchmark.compare(
fixture_path: wt.fixture_path,
entry_setup: wt.entry_setup,
entry_call: wt.entry_call,
warmup: bench_warmup,
time: bench_time,
)
md = MarkdownRenderer.render(
stem: stem,
source: source,
walkthrough: wt.walkthrough,
snapshots: snapshots,
bench: bench,
)
out_path = File.join(output_dir, "#{stem}.md")
File.write(out_path, md)
out_path
end
|