diff --git a/Users/master/.cache/cyber/nox/hemera-feature-performance/cells/B/nox/rs/benches/reduction.rs b/Users/master/.cache/cyber/nox/hemera-feature-performance/cells/D/nox/rs/benches/reduction.rs
index 002b80f..8e4f3ff 100644
--- a/Users/master/.cache/cyber/nox/hemera-feature-performance/cells/B/nox/rs/benches/reduction.rs
+++ b/Users/master/.cache/cyber/nox/hemera-feature-performance/cells/D/nox/rs/benches/reduction.rs
@@ -5,17 +5,19 @@
// ---
//! Criterion benchmarks for nox reduction patterns and jets.
-use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
+use criterion::{Criterion, Throughput, black_box, criterion_group, criterion_main};
use nebu::Goldilocks;
-use nox::data::{Reduction};
use nox::call::NullCalls;
-use nox::trace::NoTrace;
+use nox::data::Reduction;
+use nox::encode::{encode_atom, encode_tree, particle_of};
+use nox::jets::merkle_verify::merkle_verify_jet;
use nox::reduce::reduce;
+use nox::trace::NoTrace;
use nox::trace::TraceRow;
-use nox::encode::{encode_tree, encode_atom, particle_of};
-use nox::jets::merkle_verify::merkle_verify_jet;
-fn g(v: u64) -> Goldilocks { Goldilocks::new(v) }
+fn g(v: u64) -> Goldilocks {
+ Goldilocks::new(v)
+}
// โโ arithmetic patterns โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
@@ -23,16 +25,23 @@ fn bench_add(c: &mut Criterion) {
c.bench_function("pattern/add", |b| {
b.iter(|| {
let mut ar = Reduction::<4096>::new();
- let obj = ar.atom(g(0)).unwrap();
- let t5 = ar.atom(g(5)).unwrap();
- let t1 = ar.atom(g(1)).unwrap();
- let va = ar.atom(g(12345678)).unwrap();
- let vb = ar.atom(g(87654321)).unwrap();
- let qa = ar.pair(t1, va).unwrap();
- let qb = ar.pair(t1, vb).unwrap();
+ let obj = ar.atom(g(0)).unwrap();
+ let t5 = ar.atom(g(5)).unwrap();
+ let t1 = ar.atom(g(1)).unwrap();
+ let va = ar.atom(g(12345678)).unwrap();
+ let vb = ar.atom(g(87654321)).unwrap();
+ let qa = ar.pair(t1, va).unwrap();
+ let qb = ar.pair(t1, vb).unwrap();
let body = ar.pair(qa, qb).unwrap();
- let fml = ar.pair(t5, body).unwrap();
- black_box(reduce(&mut ar, obj, fml, 1_000_000, &NullCalls, &mut NoTrace))
+ let fml = ar.pair(t5, body).unwrap();
+ black_box(reduce(
+ &mut ar,
+ obj,
+ fml,
+ 1_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ ))
})
});
}
@@ -41,16 +50,23 @@ fn bench_mul(c: &mut Criterion) {
c.bench_function("pattern/mul", |b| {
b.iter(|| {
let mut ar = Reduction::<4096>::new();
- let obj = ar.atom(g(0)).unwrap();
- let t7 = ar.atom(g(7)).unwrap();
- let t1 = ar.atom(g(1)).unwrap();
- let va = ar.atom(g(999_999_999)).unwrap();
- let vb = ar.atom(g(111_111_111)).unwrap();
- let qa = ar.pair(t1, va).unwrap();
- let qb = ar.pair(t1, vb).unwrap();
+ let obj = ar.atom(g(0)).unwrap();
+ let t7 = ar.atom(g(7)).unwrap();
+ let t1 = ar.atom(g(1)).unwrap();
+ let va = ar.atom(g(999_999_999)).unwrap();
+ let vb = ar.atom(g(111_111_111)).unwrap();
+ let qa = ar.pair(t1, va).unwrap();
+ let qb = ar.pair(t1, vb).unwrap();
let body = ar.pair(qa, qb).unwrap();
- let fml = ar.pair(t7, body).unwrap();
- black_box(reduce(&mut ar, obj, fml, 1_000_000, &NullCalls, &mut NoTrace))
+ let fml = ar.pair(t7, body).unwrap();
+ black_box(reduce(
+ &mut ar,
+ obj,
+ fml,
+ 1_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ ))
})
});
}
@@ -59,13 +75,20 @@ fn bench_inv(c: &mut Criterion) {
c.bench_function("pattern/inv", |b| {
b.iter(|| {
let mut ar = Reduction::<4096>::new();
- let obj = ar.atom(g(0)).unwrap();
- let t8 = ar.atom(g(8)).unwrap();
- let t1 = ar.atom(g(1)).unwrap();
- let va = ar.atom(g(999_999_937)).unwrap();
- let qa = ar.pair(t1, va).unwrap();
- let fml = ar.pair(t8, qa).unwrap();
- black_box(reduce(&mut ar, obj, fml, 1_000_000, &NullCalls, &mut NoTrace))
+ let obj = ar.atom(g(0)).unwrap();
+ let t8 = ar.atom(g(8)).unwrap();
+ let t1 = ar.atom(g(1)).unwrap();
+ let va = ar.atom(g(999_999_937)).unwrap();
+ let qa = ar.pair(t1, va).unwrap();
+ let fml = ar.pair(t8, qa).unwrap();
+ black_box(reduce(
+ &mut ar,
+ obj,
+ fml,
+ 1_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ ))
})
});
}
@@ -81,13 +104,20 @@ fn bench_hash(c: &mut Criterion) {
group.bench_function("pattern/hash", |b| {
b.iter(|| {
let mut ar = Reduction::<4096>::new();
- let obj = ar.atom(g(0)).unwrap();
- let t15 = ar.atom(g(15)).unwrap();
- let t1 = ar.atom(g(1)).unwrap();
+ let obj = ar.atom(g(0)).unwrap();
+ let t15 = ar.atom(g(15)).unwrap();
+ let t1 = ar.atom(g(1)).unwrap();
let input = ar.atom(g(42)).unwrap();
- let qi = ar.pair(t1, input).unwrap();
- let fml = ar.pair(t15, qi).unwrap();
- black_box(reduce(&mut ar, obj, fml, 1_000_000, &NullCalls, &mut NoTrace))
+ let qi = ar.pair(t1, input).unwrap();
+ let fml = ar.pair(t15, qi).unwrap();
+ black_box(reduce(
+ &mut ar,
+ obj,
+ fml,
+ 1_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ ))
})
});
@@ -98,14 +128,14 @@ fn bench_hash(c: &mut Criterion) {
group.bench_function("pattern/hash_chain_64", |b| {
b.iter(|| {
let mut ar = Reduction::<4096>::new();
- let obj = ar.atom(g(0)).unwrap();
- let t15 = ar.atom(g(15)).unwrap();
- let t1 = ar.atom(g(1)).unwrap();
+ let obj = ar.atom(g(0)).unwrap();
+ let t15 = ar.atom(g(15)).unwrap();
+ let t1 = ar.atom(g(1)).unwrap();
// Build a chain: hash(hash(hash(...hash(42)...))) 64 deep via compose.
// compose tag = 3; hash tag = 15.
- let t3 = ar.atom(g(3)).unwrap();
+ let t3 = ar.atom(g(3)).unwrap();
let input = ar.atom(g(42)).unwrap();
- let qi = ar.pair(t1, input).unwrap();
+ let qi = ar.pair(t1, input).unwrap();
let mut fml = ar.pair(t15, qi).unwrap();
for _ in 1..CHAIN {
let placeholder = ar.atom(g(0)).unwrap();
@@ -114,7 +144,14 @@ fn bench_hash(c: &mut Criterion) {
let pair = ar.pair(hash_fml, fml).unwrap();
fml = ar.pair(t3, pair).unwrap();
}
- black_box(reduce(&mut ar, obj, fml, 1_000_000_000, &NullCalls, &mut NoTrace))
+ black_box(reduce(
+ &mut ar,
+ obj,
+ fml,
+ 1_000_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ ))
})
});
@@ -127,24 +164,31 @@ fn bench_look(c: &mut Criterion) {
c.bench_function("pattern/look_null", |b| {
b.iter(|| {
let mut ar = Reduction::<4096>::new();
- let l0 = ar.atom(g(0)).unwrap();
- let l1 = ar.atom(g(0)).unwrap();
- let l2 = ar.atom(g(0)).unwrap();
- let l3 = ar.atom(g(0)).unwrap();
+ let l0 = ar.atom(g(0)).unwrap();
+ let l1 = ar.atom(g(0)).unwrap();
+ let l2 = ar.atom(g(0)).unwrap();
+ let l3 = ar.atom(g(0)).unwrap();
let inner = ar.pair(l2, l3).unwrap();
- let mid = ar.pair(l1, inner).unwrap();
- let rc = ar.pair(l0, mid).unwrap();
- let rest = ar.atom(g(0)).unwrap();
- let obj = ar.pair(rc, rest).unwrap();
- let t17 = ar.atom(g(17)).unwrap();
- let t1 = ar.atom(g(1)).unwrap();
- let vns = ar.atom(g(0)).unwrap();
- let vkey = ar.atom(g(42)).unwrap();
- let ns_f = ar.pair(t1, vns).unwrap();
+ let mid = ar.pair(l1, inner).unwrap();
+ let rc = ar.pair(l0, mid).unwrap();
+ let rest = ar.atom(g(0)).unwrap();
+ let obj = ar.pair(rc, rest).unwrap();
+ let t17 = ar.atom(g(17)).unwrap();
+ let t1 = ar.atom(g(1)).unwrap();
+ let vns = ar.atom(g(0)).unwrap();
+ let vkey = ar.atom(g(42)).unwrap();
+ let ns_f = ar.pair(t1, vns).unwrap();
let key_f = ar.pair(t1, vkey).unwrap();
- let body = ar.pair(ns_f, key_f).unwrap();
- let fml = ar.pair(t17, body).unwrap();
- black_box(reduce(&mut ar, obj, fml, 1_000_000, &NullCalls, &mut NoTrace))
+ let body = ar.pair(ns_f, key_f).unwrap();
+ let fml = ar.pair(t17, body).unwrap();
+ black_box(reduce(
+ &mut ar,
+ obj,
+ fml,
+ 1_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ ))
})
});
}
@@ -152,12 +196,12 @@ fn bench_look(c: &mut Criterion) {
// โโ jet: merkle_verify โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
fn bench_merkle_verify(c: &mut Criterion) {
- use hemera::tree::{hash_leaf, hash_node};
use hemera::Hash;
+ use hemera::tree::{hash_leaf, hash_node};
let leaf0 = hash_leaf(b"leaf0", 0, false);
let leaf1 = hash_leaf(b"leaf1", 1, false);
- let root = hash_node(&leaf0, &leaf1, true);
+ let root = hash_node(&leaf0, &leaf1, true);
let build_hash_data = |ar: &mut Reduction<4096>, hash: &Hash| {
let bytes = hash.as_bytes();
@@ -166,9 +210,11 @@ fn bench_merkle_verify(c: &mut Criterion) {
buf.copy_from_slice(&bytes[off..off + 8]);
ar.atom(g(u64::from_le_bytes(buf))).unwrap()
};
- let h0 = limb(0); let h1 = limb(8);
- let h2 = limb(16); let h3 = limb(24);
- let left = ar.pair(h0, h1).unwrap();
+ let h0 = limb(0);
+ let h1 = limb(8);
+ let h2 = limb(16);
+ let h3 = limb(24);
+ let left = ar.pair(h0, h1).unwrap();
let right = ar.pair(h2, h3).unwrap();
ar.pair(left, right).unwrap()
};
@@ -179,20 +225,29 @@ fn bench_merkle_verify(c: &mut Criterion) {
// object = [root ๏ฟฟ formula | [current | path]]
let root_data = build_hash_data(&mut ar, &root);
let leaf_data = build_hash_data(&mut ar, &leaf0);
- let sib_data = build_hash_data(&mut ar, &leaf1);
- let depth_id = ar.atom(g(1)).unwrap();
- let formula = ar.atom(g(0)).unwrap();
- let root_fml = ar.pair(root_data, formula).unwrap();
- let meta = ar.pair(depth_id, root_fml).unwrap();
- let dir = ar.atom(g(0)).unwrap(); // left sibling
- let step = ar.pair(sib_data, dir).unwrap();
- let term = ar.atom(g(0)).unwrap();
- let path = ar.pair(step, term).unwrap();
- let data = ar.pair(leaf_data, path).unwrap();
- let obj = ar.pair(meta, data).unwrap();
- let body = ar.atom(g(0)).unwrap();
- let mut row = TraceRow::default();
- black_box(merkle_verify_jet(&mut ar, obj, body, 1_000_000, &NullCalls, &mut NoTrace, 0, &mut row))
+ let sib_data = build_hash_data(&mut ar, &leaf1);
+ let depth_id = ar.atom(g(1)).unwrap();
+ let formula = ar.atom(g(0)).unwrap();
+ let root_fml = ar.pair(root_data, formula).unwrap();
+ let meta = ar.pair(depth_id, root_fml).unwrap();
+ let dir = ar.atom(g(0)).unwrap(); // left sibling
+ let step = ar.pair(sib_data, dir).unwrap();
+ let term = ar.atom(g(0)).unwrap();
+ let path = ar.pair(step, term).unwrap();
+ let data = ar.pair(leaf_data, path).unwrap();
+ let obj = ar.pair(meta, data).unwrap();
+ let body = ar.atom(g(0)).unwrap();
+ let mut row = TraceRow::default();
+ black_box(merkle_verify_jet(
+ &mut ar,
+ obj,
+ body,
+ 1_000_000,
+ &NullCalls,
+ &mut NoTrace,
+ 0,
+ &mut row,
+ ))
})
});
}
@@ -209,18 +264,14 @@ fn bench_encode_tree(c: &mut Criterion) {
let root = cur;
c.bench_function("encode/tree_64", |b| {
- b.iter(|| {
- black_box(encode_tree(&ar, root))
- })
+ b.iter(|| black_box(encode_tree(&ar, root)))
});
}
fn bench_particle(c: &mut Criterion) {
let encoded = encode_atom(g(12345));
c.bench_function("encode/particle_atom", |b| {
- b.iter(|| {
- black_box(particle_of(&encoded))
- })
+ b.iter(|| black_box(particle_of(&encoded)))
});
}