From 389c29822b2af5f4a828734eb0a2d70b4f82a900 Mon Sep 17 00:00:00 2001 From: Ryan Geary Date: Mon, 24 Feb 2020 23:59:51 -0500 Subject: Improve performance and add profiling tooling Add tags, todo, *.bench, *.svg and bench_output to .gitignore Add test/bench.sh script. bench.sh runs the `bench` command on each test/long*txt file with range 3:5 and saves the output to a file for comparing performance across file sizes. Inline printing in get_choice_slice Change BufWriter<..stdout..> to BufWriter Add MockStdout for testing printing Add more reverse range tests Simplify word finding with a more uniform bounds check. Add Makefile for generating flamegraphs Redefine Choice struct as a start and end integer Improve algorithm for finding words to print Settle exclusivity at Config construction time Add tests for nonexistant field_seps Add regression test for preceding separator Use handle.write instead of write! macro for tremendous speed up --- test/bench.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 test/bench.sh (limited to 'test') diff --git a/test/bench.sh b/test/bench.sh new file mode 100755 index 0000000..53160b1 --- /dev/null +++ b/test/bench.sh @@ -0,0 +1,10 @@ +#!/bin/bash +cargo build --release # always be up to date +output="bench_output" +mkdir -p $output +inputs=($(find test -name "long*txt" | sort -r)) +for i in {0..4} +do + echo ${inputs[$i]} + bench "target/release/choose 3:5 -i ${inputs[$i]}" > $output/$1$i.bench +done -- cgit v1.2.3