Make benchmarks work again

ofc output is so spammy it's basically worthless still.
We need to use log!() or something.
3 files changed, 127 insertions(+), 75 deletions(-)

M Cargo.lock
M Cargo.toml
M benches/basic.rs
M Cargo.lock +89 -55
@@ 12,6 12,12 @@ dependencies = [
 ]
 
 [[package]]
+name = "anes"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
+
+[[package]]
 name = "argh"
 version = "0.1.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"

          
@@ 93,14 99,51 @@ source = "registry+https://github.com/ru
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
 [[package]]
+name = "ciborium"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f"
+dependencies = [
+ "ciborium-io",
+ "ciborium-ll",
+ "serde",
+]
+
+[[package]]
+name = "ciborium-io"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369"
+
+[[package]]
+name = "ciborium-ll"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b"
+dependencies = [
+ "ciborium-io",
+ "half",
+]
+
+[[package]]
 name = "clap"
-version = "2.34.0"
+version = "3.2.23"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
+checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
 dependencies = [
  "bitflags",
+ "clap_lex",
+ "indexmap",
  "textwrap",
- "unicode-width",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
+dependencies = [
+ "os_str_bytes",
 ]
 
 [[package]]

          
@@ 115,15 158,16 @@ dependencies = [
 
 [[package]]
 name = "criterion"
-version = "0.3.6"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f"
+checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb"
 dependencies = [
+ "anes",
  "atty",
  "cast",
+ "ciborium",
  "clap",
  "criterion-plot",
- "csv",
  "itertools",
  "lazy_static",
  "num-traits",

          
@@ 132,7 176,6 @@ dependencies = [
  "rayon",
  "regex",
  "serde",
- "serde_cbor",
  "serde_derive",
  "serde_json",
  "tinytemplate",

          
@@ 141,9 184,9 @@ dependencies = [
 
 [[package]]
 name = "criterion-plot"
-version = "0.4.5"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
+checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
 dependencies = [
  "cast",
  "itertools",

          
@@ 193,27 236,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "csv"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af91f40b7355f82b0a891f50e70399475945bb0b0da4f1700ce60761c9d3e359"
-dependencies = [
- "csv-core",
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "csv-core"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
-dependencies = [
- "memchr",
-]
-
-[[package]]
 name = "either"
 version = "1.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"

          
@@ 293,6 315,12 @@ source = "registry+https://github.com/ru
 checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
 
 [[package]]
+name = "hashbrown"
+version = "0.12.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
+
+[[package]]
 name = "hermit-abi"
 version = "0.1.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"

          
@@ 311,6 339,16 @@ dependencies = [
 ]
 
 [[package]]
+name = "indexmap"
+version = "1.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
 name = "instant"
 version = "0.1.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"

          
@@ 321,9 359,9 @@ dependencies = [
 
 [[package]]
 name = "io-lifetimes"
-version = "1.0.5"
+version = "1.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
+checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3"
 dependencies = [
  "libc",
  "windows-sys 0.45.0",

          
@@ 377,9 415,9 @@ checksum = "e2abad23fbc42b3700f2f279844d
 
 [[package]]
 name = "libc"
-version = "0.2.139"
+version = "0.2.140"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
 
 [[package]]
 name = "linux-raw-sys"

          
@@ 466,6 504,12 @@ source = "registry+https://github.com/ru
 checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
 
 [[package]]
+name = "os_str_bytes"
+version = "6.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
+
+[[package]]
 name = "plotters"
 version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"

          
@@ 596,25 640,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f7
 
 [[package]]
 name = "serde"
-version = "1.0.152"
+version = "1.0.154"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
-
-[[package]]
-name = "serde_cbor"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
+checksum = "8cdd151213925e7f1ab45a9bbfb129316bd00799784b174b7cc7bcd16961c49e"
 dependencies = [
- "half",
- "serde",
+ "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.152"
+version = "1.0.154"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
+checksum = "4fc80d722935453bcafdc2c9a73cd6fac4dc1938f0346035d84bf99fa9e33217"
 dependencies = [
  "proc-macro2",
  "quote",

          
@@ 623,9 660,9 @@ dependencies = [
 
 [[package]]
 name = "serde_json"
-version = "1.0.93"
+version = "1.0.94"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
+checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea"
 dependencies = [
  "itoa",
  "ryu",

          
@@ 667,12 704,9 @@ dependencies = [
 
 [[package]]
 name = "textwrap"
-version = "0.11.0"
+version = "0.16.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
+checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
 
 [[package]]
 name = "threadpool"

          
@@ 695,9 729,9 @@ dependencies = [
 
 [[package]]
 name = "unicode-ident"
-version = "1.0.7"
+version = "1.0.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "775c11906edafc97bc378816b94585fbd9a054eabaf86fdd0ced94af449efab7"
+checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
 
 [[package]]
 name = "unicode-width"

          
M Cargo.toml +1 -1
@@ 28,4 28,4 @@ logos = "0.12"
 [dev-dependencies]
 tempfile = "3"
 lang_tester = "0.7"
-criterion = "0.3"
+criterion = "0.4"

          
M benches/basic.rs +37 -19
@@ 13,11 13,11 @@ fn gen_dumb_test_code(count: usize) -> S
     for i in 0..count {
         buf += &format!(
             r#"
-fn rand{i}(x: I32): I32 =
+fn rand{i}(x I32) I32 =
     32767 * x * 17 + 4000100 - 50
 end
 
-fn collatz{i}(x: I32): I32 =
+fn collatz{i}(x I32) I32 =
     if x % 2 == 0 then
         collatz{i}(x / 2)
     else

          
@@ 25,39 25,39 @@ fn collatz{i}(x: I32): I32 =
     end
 end
 
-fn squared{i}(x: I32): I32 =
-    let y: I32 = x
-    let z: I32 = x
+fn squared{i}(x I32) I32 =
+    let y I32 = x
+    let z I32 = x
     y * z
 end
 
 
-fn foo{i}(x: I32): I32 =
+fn foo{i}(x I32) I32 =
     squared{i}(x) + squared{i}(x)
 end
 
-fn bar{i}(x: I32): I32 =
+fn bar{i}(x I32) I32 =
     rand{i}(collatz{i}(x))
 end
 
-fn baz{i}(x: I32, y: I32, z: I32): I32 =
-    let a: I32 = bar{i}(x * y)
-    let b: I32 = rand{i}(z)
-    let c: I32 = foo{i}(y)
+fn baz{i}(x I32, y I32, z I32) I32 =
+    let a I32 = bar{i}(x * y)
+    let b I32 = rand{i}(z)
+    let c I32 = foo{i}(y)
     a + b + c
 end
         "#,
             i = i
         );
     }
-    buf += "fn main(): {} =\n";
+    buf += "fn main() {} =\n";
     for i in 0..count {
         buf += &format!(
             r#"
-        let quux{i}: I32 = 10002
-        let xyzzy{i}: I32 = 26391
-        let quuz{i}: I32 = foo{i}(quux{i})
-        baz{i}(quux{i}, xyzzy{i}, quuz{i})
+        let quux{i} I32 = 10002
+        let xyzzy{i} I32 = 26391
+        let quuz{i} I32 = foo{i}(quux{i})
+        baz{i}(quux{i}, xyzzy{i}, quuz{i});
         "#,
             i = i
         );

          
@@ 71,21 71,39 @@ fn criterion_benchmark(c: &mut Criterion
     let lines = code.lines().count();
     let name = format!("compile {}ish lines", lines);
     c.bench_function(&name, |b| {
-        b.iter(|| garnet::compile("criterion.gt", black_box(&code)))
+        b.iter(|| {
+            garnet::compile(
+                "criterion.gt",
+                black_box(&code),
+                garnet::backend::Backend::Rust,
+            )
+        })
     });
 
     let code = gen_dumb_test_code(103 * 8);
     let lines = code.lines().count();
     let name = format!("compile {}ish lines", lines);
     c.bench_function(&name, |b| {
-        b.iter(|| garnet::compile("criterion.gt", black_box(&code)))
+        b.iter(|| {
+            garnet::compile(
+                "criterion.gt",
+                black_box(&code),
+                garnet::backend::Backend::Rust,
+            )
+        })
     });
 
     let code = gen_dumb_test_code(103 * 16);
     let lines = code.lines().count();
     let name = format!("compile {}ish lines", lines);
     c.bench_function(&name, |b| {
-        b.iter(|| garnet::compile("criterion.gt", black_box(&code)))
+        b.iter(|| {
+            garnet::compile(
+                "criterion.gt",
+                black_box(&code),
+                garnet::backend::Backend::Rust,
+            )
+        })
     });
 }