From 8c62383118fc045e500282a25ff4be3684520876 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 14:55:20 -0600 Subject: [PATCH 01/12] feat(jq): add experimental owned value boundary --- .github/workflows/ci.yml | 6 + crates/bashkit-cli/Cargo.toml | 1 + crates/bashkit/Cargo.toml | 3 + crates/bashkit/benches/jq.rs | 16 + ...q-owned-cloud-linux-x86_64-1795639828.json | 767 ++++++++++++++++++ ...-jq-owned-cloud-linux-x86_64-1795639828.md | 31 + crates/bashkit/docs/jq.md | 20 + crates/bashkit/fuzz/Cargo.toml | 2 + crates/bashkit/src/builtins/jq/convert.rs | 27 +- .../bashkit/src/builtins/jq/jaq_json/funs.rs | 11 + .../bashkit/src/builtins/jq/jaq_json/meter.rs | 45 + .../bashkit/src/builtins/jq/jaq_json/mod.rs | 148 +++- .../bashkit/src/builtins/jq/jaq_json/read.rs | 26 +- .../builtins/jq/jaq_json/tests/lifecycle.rs | 34 + .../bashkit/src/builtins/jq/jaq_json/write.rs | 12 + crates/bashkit/src/builtins/jq/mod.rs | 38 + crates/bashkit/src/builtins/jq/owned.rs | 239 ++++++ crates/bashkit/src/builtins/jq/owned/tests.rs | 164 ++++ crates/bashkit/src/builtins/jq/tests.rs | 21 + .../tests/integration/jq_value_depth_tests.rs | 40 + knowledge/operations/dependencies.md | 4 + knowledge/runtimes/jaq-json-vendor.md | 70 ++ knowledge/security/security-testing.md | 7 + knowledge/security/threat-model.md | 8 + site/src/data/performance-timeline.json | 37 +- 25 files changed, 1755 insertions(+), 22 deletions(-) create mode 100644 crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.json create mode 100644 crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md create mode 100644 crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs create mode 100644 crates/bashkit/src/builtins/jq/owned.rs create mode 100644 crates/bashkit/src/builtins/jq/owned/tests.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f792f348..61f0f0cd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -363,6 +363,12 @@ jobs: - name: Install pinned jq for differential tests run: scripts/install-jq-ci.sh "$JQ_VERSION" + # jq/yq share the experimental owned value boundary. Keep the default + # workspace run below on the established backend; exercise both here. + - name: Test experimental jq containers + if: ${{ !matrix.execution_plan }} + run: cargo test -p bashkit --no-default-features --features experimental_jq --lib --test integration -- jq yq + # Examples have a dedicated job below; skipping them here avoids # duplicated example links that can exhaust runner disk on main. - name: Run tests diff --git a/crates/bashkit-cli/Cargo.toml b/crates/bashkit-cli/Cargo.toml index 5813bdc5a..639ca237e 100644 --- a/crates/bashkit-cli/Cargo.toml +++ b/crates/bashkit-cli/Cargo.toml @@ -23,6 +23,7 @@ path = "src/main.rs" doc = false # Disable to avoid collision with bashkit library docs [features] +experimental_jq = ["bashkit/experimental_jq"] # Opt-in script compiler; preserves ordinary Bash syntax and AST fallback. experimental_execution_plan = ["bashkit/experimental_execution_plan"] default = ["python", "sqlite", "interactive"] diff --git a/crates/bashkit/Cargo.toml b/crates/bashkit/Cargo.toml index 89df8434a..df9121abe 100644 --- a/crates/bashkit/Cargo.toml +++ b/crates/bashkit/Cargo.toml @@ -216,6 +216,9 @@ wasm_js = [ # See knowledge/integrations/in-process-terminal.md. # Usage: cargo build --features terminal terminal = ["dep:vt100"] +# Experimental Bashkit-owned value/resource boundary; never implied by `jq`. +# Reuses jaq's parser/evaluator. See knowledge/runtimes/jaq-json-vendor.md. +experimental_jq = ["jq"] # Enable jq builtin via embedded jaq interpreter # Usage: cargo build --features jq jq = [ diff --git a/crates/bashkit/benches/jq.rs b/crates/bashkit/benches/jq.rs index bd1c4dbb9..a299f5405 100644 --- a/crates/bashkit/benches/jq.rs +++ b/crates/bashkit/benches/jq.rs @@ -83,6 +83,22 @@ fn bench_jq(c: &mut Criterion) { (large_input_script(), format!("{}\n", 4 * ROWS)), 1, ), + ( + "array_updates_4096", + ( + "jq -n 'reduce range(4096) as $i ([]; .[$i] = $i) | length'".into(), + "4096\n".into(), + ), + 1, + ), + ( + "object_updates_4096", + ( + "jq -n 'reduce range(4096) as $i ({}; .[$i|tostring] = $i) | length'".into(), + "4096\n".into(), + ), + 1, + ), ]; for (name, (script, expected), calls) in &cases { group.throughput(Throughput::Elements(*calls as u64)); diff --git a/crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.json b/crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.json new file mode 100644 index 000000000..782ed8580 --- /dev/null +++ b/crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.json @@ -0,0 +1,767 @@ +{ + "base_revision": "5b9e78324c2155e4feb68a2f14a357cd21c1f40c", + "toolchain": "Rust 1.100.0", + "profile": "bench, opt-level=3, fat LTO, codegen-units=1", + "samples": 20, + "warm_up_seconds": 0.3, + "measurement_seconds": 1.0, + "features": { + "established": "jq", + "experimental": "experimental_jq" + }, + "default_features": false, + "cases": [ + { + "benchmark": "jq/aggregate_4096_rows", + "established_median_ns": 13239764.75, + "experimental_median_ns": 13350886.5, + "change_pct": 0.8393030548371261, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13451032.0984375, + "upper_bound": 16710428.4403125 + }, + "point_estimate": 14880617.1375, + "standard_error": 838342.9705074843 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13081941.0, + "upper_bound": 13698045.625 + }, + "point_estimate": 13239764.75, + "standard_error": 225129.31053112214 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 226241.42013341188, + "upper_bound": 1366719.4037608802 + }, + "point_estimate": 642157.5999744236, + "standard_error": 353297.65244791313 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1159623.705596595, + "upper_bound": 5381810.264105036 + }, + "point_estimate": 3850850.528658691, + "standard_error": 1062978.7450598965 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13253473.634375, + "upper_bound": 13650421.646875 + }, + "point_estimate": 13447389.8875, + "standard_error": 101285.79356942946 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13159398.125, + "upper_bound": 13681857.0 + }, + "point_estimate": 13350886.5, + "standard_error": 138247.04737085672 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 214034.43325012922, + "upper_bound": 741250.3197401762 + }, + "point_estimate": 446953.8543149829, + "standard_error": 136837.5561930724 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 327253.56719096284, + "upper_bound": 564527.9622388419 + }, + "point_estimate": 465181.917659021, + "standard_error": 60663.84730984814 + } + } + }, + { + "benchmark": "jq/array_updates_4096", + "established_median_ns": 3895224.567708333, + "experimental_median_ns": 4248353.642857143, + "change_pct": 9.065692337131793, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3917483.1994375517, + "upper_bound": 4565684.211299726 + }, + "point_estimate": 4194896.542938991, + "standard_error": 168606.66177724875 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3814949.5066176467, + "upper_bound": 4072311.0178571427 + }, + "point_estimate": 3895224.567708333, + "standard_error": 90820.10540705202 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 58075.72973269997, + "upper_bound": 396051.745784853 + }, + "point_estimate": 223865.57684121723, + "standard_error": 93296.79300349482 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3869998.333933344, + "upper_bound": 4345289.744842971 + }, + "point_estimate": 4058878.9736933797, + "standard_error": 126924.49283687322 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 173240.6847773277, + "upper_bound": 1142662.936060398 + }, + "point_estimate": 772889.2761129844, + "standard_error": 259349.4069233342 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4208272.30197984, + "upper_bound": 4382275.4754171185 + }, + "point_estimate": 4287902.568171187, + "standard_error": 44524.966261141526 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4208067.875, + "upper_bound": 4348293.3003095975 + }, + "point_estimate": 4248353.642857143, + "standard_error": 36533.417765409584 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 53085.048032552004, + "upper_bound": 210146.80901914788 + }, + "point_estimate": 148170.53350845666, + "standard_error": 40349.479320134815 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4241935.795156187, + "upper_bound": 4395033.090291705 + }, + "point_estimate": 4316962.165505227, + "standard_error": 38902.29848504113 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 98026.719214961, + "upper_bound": 295001.4258160073 + }, + "point_estimate": 204707.29447949785, + "standard_error": 54715.792958381426 + } + } + }, + { + "benchmark": "jq/distinct_filters", + "established_median_ns": 38181130.0, + "experimental_median_ns": 37718589.5, + "change_pct": -1.2114374299555863, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 37979358.34875, + "upper_bound": 43453008.98125 + }, + "point_estimate": 40152755.05, + "standard_error": 1458052.0589822356 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 37081549.75, + "upper_bound": 39530802.25 + }, + "point_estimate": 38181130.0, + "standard_error": 758299.7137381119 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 784761.6637676954, + "upper_bound": 3698793.0088832974 + }, + "point_estimate": 2073801.539182663, + "standard_error": 791360.0159161019 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1535098.6149896386, + "upper_bound": 10537507.686725767 + }, + "point_estimate": 6678741.965087238, + "standard_error": 2817656.9217073233 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 37151220.425, + "upper_bound": 40870469.255 + }, + "point_estimate": 38702809.15, + "standard_error": 974169.6057204864 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 36481859.0, + "upper_bound": 38647237.0 + }, + "point_estimate": 37718589.5, + "standard_error": 502139.98198775813 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 800350.0905409455, + "upper_bound": 3255511.5547031164 + }, + "point_estimate": 2121701.0084822774, + "standard_error": 642930.5418514499 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1417113.5688127019, + "upper_bound": 6856417.634313909 + }, + "point_estimate": 4446877.311134407, + "standard_error": 1647771.853322943 + } + } + }, + { + "benchmark": "jq/hot_and_unique_filters", + "established_median_ns": 20573307.666666664, + "experimental_median_ns": 20376604.166666664, + "change_pct": -0.9561102336436811, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 20486679.995833334, + "upper_bound": 24746468.57833333 + }, + "point_estimate": 22347655.516666666, + "standard_error": 1098947.717483061 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 20017626.0, + "upper_bound": 21374336.0 + }, + "point_estimate": 20573307.666666664, + "standard_error": 336940.7972119241 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 500675.9879112225, + "upper_bound": 2057488.4916722775 + }, + "point_estimate": 1092744.627299901, + "standard_error": 424127.9201850674 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 899516.8759883058, + "upper_bound": 7071004.212713978 + }, + "point_estimate": 5036058.186308984, + "standard_error": 1538172.8405570989 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 19776868.330833334, + "upper_bound": 22043890.286250003 + }, + "point_estimate": 20741220.85, + "standard_error": 589482.1719177475 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 19578402.333333336, + "upper_bound": 21294271.666666668 + }, + "point_estimate": 20376604.166666664, + "standard_error": 397652.17045480816 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 708834.50681567, + "upper_bound": 2395124.937278034 + }, + "point_estimate": 1622283.3772987118, + "standard_error": 427553.78312971164 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1067754.3412213654, + "upper_bound": 4167365.110992034 + }, + "point_estimate": 2700780.2773289406, + "standard_error": 956489.4049021422 + } + } + }, + { + "benchmark": "jq/interleaved_filters", + "established_median_ns": 4161487.5359477126, + "experimental_median_ns": 3877007.4331550803, + "change_pct": -6.836019580384168, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4083552.9113770584, + "upper_bound": 4647071.344407447 + }, + "point_estimate": 4329721.022897728, + "standard_error": 145267.92690046906 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3969249.075, + "upper_bound": 4276987.5 + }, + "point_estimate": 4161487.5359477126, + "standard_error": 101545.8237148176 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 103122.5793060501, + "upper_bound": 479124.4204938412 + }, + "point_estimate": 292540.6037438661, + "standard_error": 98130.47190088667 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4049543.0747234486, + "upper_bound": 4646461.783116062 + }, + "point_estimate": 4293716.314982578, + "standard_error": 153818.43542331888 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 201104.17826641988, + "upper_bound": 961271.2374863217 + }, + "point_estimate": 666951.4809909923, + "standard_error": 196773.88152644172 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3841532.9709618427, + "upper_bound": 4012444.319804022 + }, + "point_estimate": 3916094.1962342234, + "standard_error": 44120.382705952856 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3840705.283333333, + "upper_bound": 3925033.0497076027 + }, + "point_estimate": 3877007.4331550803, + "standard_error": 21079.553625336473 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 38240.339192274565, + "upper_bound": 152558.57768387772 + }, + "point_estimate": 83722.7087969582, + "standard_error": 31449.971469090935 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3837904.658227284, + "upper_bound": 3939624.345992412 + }, + "point_estimate": 3885078.479790941, + "standard_error": 26037.95294605587 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 75895.64510660304, + "upper_bound": 305306.34505696164 + }, + "point_estimate": 202589.36342558957, + "standard_error": 65789.36820865682 + } + } + }, + { + "benchmark": "jq/object_updates_4096", + "established_median_ns": 7123475.395833334, + "experimental_median_ns": 8061342.73888889, + "change_pct": 13.165867655051255, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7088840.832342526, + "upper_bound": 7722943.732856857 + }, + "point_estimate": 7349803.387870188, + "standard_error": 165636.75996283581 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7009746.488636363, + "upper_bound": 7374772.678571429 + }, + "point_estimate": 7123475.395833334, + "standard_error": 99596.14287943012 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 116922.30231588031, + "upper_bound": 571801.4236184966 + }, + "point_estimate": 248554.65563727266, + "standard_error": 117870.19421099043 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7152475.527480939, + "upper_bound": 8341413.333023787 + }, + "point_estimate": 7665496.098606272, + "standard_error": 317485.45668064215 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 249407.39236036935, + "upper_bound": 1188079.258036917 + }, + "point_estimate": 760529.3683809424, + "standard_error": 293206.6766059784 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7793289.495173127, + "upper_bound": 9063451.161368456 + }, + "point_estimate": 8378471.064619914, + "standard_error": 325646.59417373175 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7698783.521428572, + "upper_bound": 8343913.909090909 + }, + "point_estimate": 8061342.73888889, + "standard_error": 163313.66274549067 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 286294.89208694623, + "upper_bound": 1445701.9892236588 + }, + "point_estimate": 538312.8507730362, + "standard_error": 291915.03980649065 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7920634.662743832, + "upper_bound": 9578907.246511845 + }, + "point_estimate": 8646203.231358886, + "standard_error": 436239.36573883734 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 605894.4788641417, + "upper_bound": 1943881.7221578867 + }, + "point_estimate": 1500432.4466190434, + "standard_error": 317402.2573142468 + } + } + }, + { + "benchmark": "jq/repeated_filter", + "established_median_ns": 2313764.766826923, + "experimental_median_ns": 2328724.997115385, + "change_pct": 0.6465752483982179, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2281972.287163024, + "upper_bound": 2402496.0535711246 + }, + "point_estimate": 2340934.396874505, + "standard_error": 30823.527267144298 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2261874.375, + "upper_bound": 2429786.916666667 + }, + "point_estimate": 2313764.766826923, + "standard_error": 38923.24318209039 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 54225.8096080215, + "upper_bound": 223817.08344317076 + }, + "point_estimate": 154095.78112987813, + "standard_error": 45638.95142146437 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2241827.6174417487, + "upper_bound": 2421943.793672879 + }, + "point_estimate": 2328409.0545296166, + "standard_error": 46239.80204196592 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 96628.9934982657, + "upper_bound": 172559.4463809199 + }, + "point_estimate": 141296.1984659743, + "standard_error": 19327.37812295953 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2264724.0768889454, + "upper_bound": 2534762.1308387243 + }, + "point_estimate": 2371330.5491166944, + "standard_error": 72747.20573741698 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2241717.6916666664, + "upper_bound": 2384201.8740601502 + }, + "point_estimate": 2328724.997115385, + "standard_error": 39973.162347891564 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 48877.64324382705, + "upper_bound": 184335.35983397192 + }, + "point_estimate": 113096.63753761395, + "standard_error": 33094.11945043314 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2304546.569870964, + "upper_bound": 2482328.658575863 + }, + "point_estimate": 2372267.451219512, + "standard_error": 46213.58259387115 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 85677.40367266697, + "upper_bound": 538653.6731608615 + }, + "point_estimate": 333898.45821843005, + "standard_error": 150076.49463544626 + } + } + }, + { + "benchmark": "jq/single_lookup", + "established_median_ns": 580347.4464285714, + "experimental_median_ns": 576902.1479166667, + "change_pct": -0.5936613546086655, + "established_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 578852.8028100331, + "upper_bound": 688332.7811631523 + }, + "point_estimate": 627737.5291536839, + "standard_error": 28107.34200824813 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 559525.2740429505, + "upper_bound": 606056.7392857142 + }, + "point_estimate": 580347.4464285714, + "standard_error": 14455.109403466491 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 23370.948800082715, + "upper_bound": 97509.67835052384 + }, + "point_estimate": 44121.38979168871, + "standard_error": 20290.347862747945 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 577187.3523485269, + "upper_bound": 725373.9464699689 + }, + "point_estimate": 645554.0957192633, + "standard_error": 37286.141177268146 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 49304.858370986614, + "upper_bound": 175935.1026897505 + }, + "point_estimate": 129871.3157236093, + "standard_error": 31561.93424816324 + } + }, + "experimental_estimates": { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 572445.3870489, + "upper_bound": 606925.3218679959 + }, + "point_estimate": 587765.9193012039, + "standard_error": 8864.44146352679 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 572343.8348214286, + "upper_bound": 586039.4930555555 + }, + "point_estimate": 576902.1479166667, + "standard_error": 3737.0706988170696 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 5478.543576486449, + "upper_bound": 37052.22244702107 + }, + "point_estimate": 21709.558793990087, + "standard_error": 9095.10542792065 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 569349.2480642146, + "upper_bound": 599543.8505632583 + }, + "point_estimate": 581418.4914634146, + "standard_error": 7901.984141264275 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 15029.29991487896, + "upper_bound": 57671.647413644365 + }, + "point_estimate": 40783.41489321949, + "standard_error": 11300.08531177632 + } + } + } + ] +} diff --git a/crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md b/crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md new file mode 100644 index 000000000..a1e723fea --- /dev/null +++ b/crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md @@ -0,0 +1,31 @@ +# Criterion jq Experimental Owned Containers + +Compares the established `jq` configuration with opt-in `experimental_jq`. +Both use jaq for parsing and evaluation. Scripts run through `Bash::exec` +and assert their outputs. The new update cases each build 4,096 entries. + +Rust 1.100.0, Linux x86-64, repository bench profile (fat LTO, one codegen +unit), no default features. Each final run used 20 samples, a 0.3-second +warmup and a one-second measurement target. Builds and test runs completed +before the final paired measurements. This is an exploratory single pair; +it does not establish a performance improvement. Positive change is slower. + +| Benchmark | Before | After | Change | +|---|---:|---:|---:| +| `jq/aggregate_4096_rows` | 13.240 ms | 13.351 ms | +0.8% | +| `jq/array_updates_4096` | 3.895 ms | 4.248 ms | +9.1% | +| `jq/distinct_filters` | 38.181 ms | 37.719 ms | -1.2% | +| `jq/hot_and_unique_filters` | 20.573 ms | 20.377 ms | -1.0% | +| `jq/interleaved_filters` | 4.161 ms | 3.877 ms | -6.8% | +| `jq/object_updates_4096` | 7.123 ms | 8.061 ms | +13.2% | +| `jq/repeated_filter` | 2.314 ms | 2.329 ms | +0.6% | +| `jq/single_lookup` | 0.580 ms | 0.577 ms | -0.6% | + +The owned path adds lifecycle interruption, incremental container accounting, +pre-copy admission and retained iterator charges. Resource admission can +also reject earlier near the configured byte limit. Keep the experiment +disabled by default while reviewing compatibility, safety and performance. + +Reproduce the two builds with `cargo bench -p bashkit --no-default-features +--features jq --bench jq` and the same command using `--features experimental_jq`. +The paired JSON includes the raw Criterion estimates for both configurations. diff --git a/crates/bashkit/docs/jq.md b/crates/bashkit/docs/jq.md index c42a75216..b2a90b4b4 100644 --- a/crates/bashkit/docs/jq.md +++ b/crates/bashkit/docs/jq.md @@ -7,6 +7,26 @@ bashkit) can avoid surprises. [jaq]: https://github.com/01mf02/jaq +## Experimental owned containers + +Build with `--features experimental_jq` to opt into Bashkit's owned jq +container/resource boundary. This Cargo feature enables `jq`; it is disabled +by default and also available on `bashkit-cli`. It applies to both `jq` and +`yq`, which share the value runtime. + +The experiment retains jaq's parser, evaluator, standard library and Bashkit's +jq compatibility shim. Array/object construction and mutation use an API that +checks nesting before attachment, admits storage before growth or copy-on-write, +and updates memory accounting and cached depth together. Collection builders +charge storage incrementally. The same memory, depth, output, timeout and +cancellation limits apply; conservative storage admission can reject a value +earlier than the existing implementation. Performance improvement is not +assumed. Untrusted filters still require unwinding builds or process isolation, +as described below. Disable the feature to return to the existing implementation. + +Comparison, hashing, containment and formatting also poll the execution stop +check while traversing values, including shared generated trees. + ## Reported version `jq --version` prints `jq-1.8`. Filters generated for stedfan/jq 1.7 and 1.8 diff --git a/crates/bashkit/fuzz/Cargo.toml b/crates/bashkit/fuzz/Cargo.toml index f1b4c8bde..e0de57e15 100644 --- a/crates/bashkit/fuzz/Cargo.toml +++ b/crates/bashkit/fuzz/Cargo.toml @@ -20,6 +20,8 @@ path = ".." features = ["jq"] [features] +# Run the jq lifecycle/resource corpus against owned containers. +experimental_jq = ["bashkit/experimental_jq"] # Exercise the shipping feature independently of the diagnostic selector. experimental_execution_plan = ["bashkit/experimental_execution_plan"] plan_differential = ["experimental_execution_plan", "bashkit/experimental_plan_benchmark_control"] diff --git a/crates/bashkit/src/builtins/jq/convert.rs b/crates/bashkit/src/builtins/jq/convert.rs index 5b72d4b4f..5d9da8cc5 100644 --- a/crates/bashkit/src/builtins/jq/convert.rs +++ b/crates/bashkit/src/builtins/jq/convert.rs @@ -265,10 +265,9 @@ pub(super) fn jq_to_val(v: &JqJson) -> Val { } JqJson::String(s) => Val::from(s.clone()), JqJson::Array(arr) => arr.iter().map(jq_to_val).collect(), - JqJson::Object(map) => Val::obj( + JqJson::Object(map) => object_value( map.iter() - .map(|(k, v)| (Val::from(k.clone()), jq_to_val(v))) - .collect(), + .map(|(k, v)| (Val::from(k.clone()), jq_to_val(v))), ), } } @@ -293,15 +292,31 @@ pub(super) fn jq_into_val(value: JqJson) -> Val { } JqJson::String(s) => Val::from(s), JqJson::Array(values) => values.into_iter().map(jq_into_val).collect(), - JqJson::Object(entries) => Val::obj( + JqJson::Object(entries) => object_value( entries .into_iter() - .map(|(key, value)| (Val::from(key), jq_into_val(value))) - .collect(), + .map(|(key, value)| (Val::from(key), jq_into_val(value))), ), } } +// Input/global objects must enter the same incremental owned builder as +// evaluator-created objects; collecting a raw Map first bypasses admission. +fn object_value(entries: impl IntoIterator) -> Val { + #[cfg(feature = "experimental_jq")] + { + match super::owned::object(entries) { + Ok(value) => value, + Err(_) => { + super::jaq_json::meter::require(usize::MAX); + Val::Null // panic-abort fallback; the meter remains tripped + } + } + } + #[cfg(not(feature = "experimental_jq"))] + Val::obj(entries.into_iter().collect()) +} + /// Convert jaq Val back to JqJson for output formatting. Captures number /// representation via Val's Display (jaq preserves the original token). /// Convert a result for output. `None` when the value would render to more diff --git a/crates/bashkit/src/builtins/jq/jaq_json/funs.rs b/crates/bashkit/src/builtins/jq/jaq_json/funs.rs index c1844554f..010c25ade 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/funs.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/funs.rs @@ -60,6 +60,9 @@ impl Val { /// there is a key-value pair `k, v'` in `a` such that `v'` contains `v`, or /// * `a` equals `b`. fn contains(&self, other: &Self) -> bool { + // BASHKIT PATCH: shared generated trees need traversal interruption. + #[cfg(feature = "experimental_jq")] + super::meter::tick(); match (self, other) { (Self::BStr(l), Self::BStr(r)) | (Self::TStr(l), Self::TStr(r)) => l.contains_str(&**r), (Self::Arr(l), Self::Arr(r)) => r.iter().all(|r| l.iter().any(|l| l.contains(r))), @@ -71,6 +74,9 @@ impl Val { } fn to_bytes(&self) -> Result { + // BASHKIT PATCH: poll even while recursively traversing empty leaves. + #[cfg(feature = "experimental_jq")] + super::meter::tick(); match self { Val::Num(n) => n .as_isize() @@ -194,3 +200,8 @@ fn base DataT = Val>>() -> Box<[Filter>]> { }), ]) } + +// BASHKIT PATCH: bounded regressions for traversal with no output or growth. +#[cfg(all(test, feature = "experimental_jq"))] +#[path = "tests/lifecycle.rs"] +mod lifecycle_tests; diff --git a/crates/bashkit/src/builtins/jq/jaq_json/meter.rs b/crates/bashkit/src/builtins/jq/jaq_json/meter.rs index 7f56b887d..b65fa2b9b 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/meter.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/meter.rs @@ -186,6 +186,17 @@ pub fn check(extra: usize) -> Result<(), Error> { } } +/// BASHKIT PATCH: pre-allocation admission for infallible owned constructors +/// and Rc copy-on-write clones. Panic-abort builds leave the meter tripped. +#[cfg(feature = "experimental_jq")] +pub(crate) fn require(extra: usize) -> bool { + if current().is_some_and(|meter| !meter.fits(extra)) { + abort(Abort::Memory); + return false; + } + true +} + /// Room left for new allocations, `usize::MAX` without a meter. pub fn headroom() -> usize { match current() { @@ -408,8 +419,42 @@ impl Metered { core::mem::take(&mut self.inner) // `self` drops here and releases `charged`. } + + /// BASHKIT PATCH: an owning iterator retains the allocated body. Transfer + /// its charge instead of refunding while the buffer is still alive. + #[cfg(feature = "experimental_jq")] + pub(crate) fn into_charged_iter(mut self) -> OwnedIter + where + T: Default + IntoIterator, + { + let inner = core::mem::take(&mut self.inner); + let charge = self.meter.take().map(|meter| Charge { meter, bytes: self.charged }); + self.charged = 0; + OwnedIter { iter: inner.into_iter(), _charge: charge } + } } +/// BASHKIT PATCH: release the allocation before refunding its meter charge. +#[cfg(feature = "experimental_jq")] +pub(crate) struct OwnedIter { + iter: I, + _charge: Option, +} + +#[cfg(feature = "experimental_jq")] +impl Iterator for OwnedIter { + type Item = I::Item; + fn next(&mut self) -> Option { + self.iter.next() + } + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } +} + +#[cfg(feature = "experimental_jq")] +impl ExactSizeIterator for OwnedIter {} + impl Drop for Metered { fn drop(&mut self) { if let Some(m) = &self.meter { diff --git a/crates/bashkit/src/builtins/jq/jaq_json/mod.rs b/crates/bashkit/src/builtins/jq/jaq_json/mod.rs index 32f248451..5efa9bc44 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/mod.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/mod.rs @@ -35,19 +35,30 @@ use num_traits::{cast::ToPrimitive, Signed}; pub use funs::{bytes_valrs, funs}; pub use num::Num; use meter::{Metered, Str}; +// BASHKIT PATCH: experimental bodies expose checked mutation only. +#[cfg(feature = "experimental_jq")] +use super::owned::Container; +#[cfg(not(feature = "experimental_jq"))] +type Container = Metered; /// BASHKIT PATCH: wrap a new array/object body so it is metered. -pub(crate) fn metered(t: T) -> Rc> { +pub(crate) fn metered(t: T) -> Rc> { admit_container(Metered::new(t)) } /// BASHKIT PATCH: retain an existing memory charge while admitting depth. -pub(crate) fn admit_container(mut body: Metered) -> Rc> { +pub(crate) fn admit_container(body: Metered) -> Rc> { + #[cfg(feature = "experimental_jq")] + return Rc::new(Container::admit(body)); + #[cfg(not(feature = "experimental_jq"))] + { + let mut body = body; if meter::check_depth(body.depth(ValueDepth::value_depth)).is_err() { // panic-abort fallback: never retain a rejected tree. body = Metered::default(); } Rc::new(body) + } } // BASHKIT PATCH (#3013): count containers, scalars have depth zero. Check @@ -111,9 +122,9 @@ pub enum Val { TStr(Box), /// Array // BASHKIT PATCH: bodies are `Metered` (TM-DOS-110). - Arr(Rc>>), + Arr(Rc>>), /// Object - Obj(Rc>>), + Obj(Rc>>), } #[cfg(any())] @@ -163,6 +174,12 @@ impl Type { } } +// BASHKIT PATCH: share the diagnostic without exposing jqmsg internals. +#[cfg(feature = "experimental_jq")] +pub(super) fn invalid_object_key(key: &Val) -> ValR { + Err(jqmsg::object_key(key)) +} + /// Order-preserving map pub type Map = indexmap::IndexMap; @@ -176,7 +193,7 @@ pub type ValX<'a> = jaq_core::ValX<'a, Val>; // This is part of the Rust standard library since 1.76: // . // However, to keep MSRV low, we reimplement it here. -fn rc_unwrap_or_clone(a: Rc) -> T { +pub(super) fn rc_unwrap_or_clone(a: Rc) -> T { Rc::try_unwrap(a).unwrap_or_else(|a| (*a).clone()) } @@ -187,6 +204,11 @@ impl jaq_core::ValT for Val { } fn from_map>(iter: I) -> ValR { + // BASHKIT PATCH: own incremental construction under the experiment. + #[cfg(feature = "experimental_jq")] + return super::owned::object(iter); + #[cfg(not(feature = "experimental_jq"))] + { // BASHKIT PATCH: jq object keys are strings only. let mut m = Map::default(); for (k, v) in iter { @@ -196,6 +218,7 @@ impl jaq_core::ValT for Val { m.insert(k, v); } Ok(Self::obj(m)) + } } fn key_values(self) -> Box>> { @@ -251,7 +274,18 @@ impl jaq_core::ValT for Val { } Self::Obj(o) => { let iter = rc_unwrap_or_clone(o).into_iter(); - let iter = iter.filter_map(|(k, v)| f(v).next().map(|v| Ok((k, v?)))); + let iter = iter.filter_map(|(k, v)| f(v).next().map(|v| Ok::<_, Exn<_>>((k, v?)))); + // BASHKIT PATCH: admit each updated entry before collection. + #[cfg(feature = "experimental_jq")] + { + let mut body = Container::::default(); + for entry in iter { + let (key, value) = entry?; + body.insert(key, value)?; + } + return Ok(Self::Obj(Rc::new(body))); + } + #[cfg(not(feature = "experimental_jq"))] Ok(Self::obj(iter.collect::>>()?)) } v => opt.fail(v, |v| Exn::from(jqmsg::iter(v))), // BASHKIT PATCH @@ -436,6 +470,19 @@ impl Val { opt.fail(self, |_| Exn::from(e)) } Val::Obj(ref mut o) => { + // BASHKIT PATCH: checked attachments and COW in owned mode. + #[cfg(feature = "experimental_jq")] + { + let o = Rc::make_mut(o); + let old = o.take(index).unwrap_or_default(); + if let Some(value) = f(old).next().transpose()? { + o.insert(index.clone(), value)?; + } else { + o.remove(index); + } + } + #[cfg(not(feature = "experimental_jq"))] + { use indexmap::map::Entry::{Occupied, Vacant}; match Rc::make_mut(o).entry(index.clone()) { Occupied(mut e) => { @@ -460,6 +507,7 @@ impl Val { // BASHKIT PATCH: charge in-place growth (TM-DOS-110). Rc::make_mut(o).resync(); meter::check(0)?; + } Ok(self) } Val::Arr(ref mut a) => { @@ -494,14 +542,31 @@ impl Val { meter::check_depth(1 + y.value_depth())?; // BASHKIT PATCH let grow = (i + 1 - len).saturating_mul(core::mem::size_of::()); meter::check(grow)?; + #[cfg(feature = "experimental_jq")] + Rc::make_mut(a).set(i, y)?; + #[cfg(not(feature = "experimental_jq"))] + { let a = Rc::make_mut(a); a.resize(i, Val::Null); a.push(y); a.resync(); // BASHKIT PATCH (TM-DOS-110) meter::check(0)?; + } return Ok(self); } + #[cfg(feature = "experimental_jq")] + { + let a = Rc::make_mut(a); + let old = a.take(i); + if let Some(value) = f(old).next().transpose()? { + a.set(i, value)?; + } else { + a.remove(i); + } + } + #[cfg(not(feature = "experimental_jq"))] + { let a = Rc::make_mut(a); let x = core::mem::take(&mut a[i]); if let Some(y) = f(x).next().transpose()? { @@ -511,6 +576,7 @@ impl Val { a.remove(i); } a.resync(); // BASHKIT PATCH (TM-DOS-110) + } Ok(self) } _ => opt.fail(self, |v| Exn::from(jqmsg::iter(v))), // BASHKIT PATCH @@ -550,9 +616,15 @@ impl Val { let y = f(arr).map(|y| y?.into_arr().map_err(Exn::from)).next(); let y = y.transpose()?.unwrap_or_default(); meter::check((a.len() - take + y.len()) * core::mem::size_of::())?; // BASHKIT PATCH + // BASHKIT PATCH: owned splice has no unmetered temporary Vec. + #[cfg(feature = "experimental_jq")] + Rc::make_mut(a).splice(skip, take, &y)?; + #[cfg(not(feature = "experimental_jq"))] + { let a = Rc::make_mut(a); a.splice(skip..skip + take, (**y).clone()); a.resync(); // BASHKIT PATCH (TM-DOS-110) + } Ok(self) } Val::BStr(b) => fs(b.into_bytes(), range, stb, Val::into_byte_str, Val::byte_str), @@ -604,14 +676,14 @@ impl Val { } /// If the value is an array, return it, else fail. - fn into_arr(self) -> Result>>, Error> { + fn into_arr(self) -> Result>>, Error> { match self { Self::Arr(a) => Ok(a), _ => Err(Error::typ(self, Type::Arr.as_str())), } } - fn as_arr(&self) -> Result<&Rc>>, Error> { + fn as_arr(&self) -> Result<&Rc>>, Error> { match self { Self::Arr(a) => Ok(a), _ => Err(Error::typ(self.clone(), Type::Arr.as_str())), @@ -725,6 +797,9 @@ impl From> for Val { impl FromIterator for Val { fn from_iter>(iter: T) -> Self { // BASHKIT PATCH: stop at the meter's limit (TM-DOS-110). + #[cfg(feature = "experimental_jq")] + return Self::Arr(Rc::new(super::owned::array(iter))); + #[cfg(not(feature = "experimental_jq"))] Self::Arr(admit_container(meter::collect_vec(iter))) } } @@ -761,16 +836,26 @@ impl core::ops::Add for Val { (Arr(mut l), Arr(r)) => { //std::dbg!(Rc::strong_count(&l)); meter::check((l.len() + r.len()) * val_size)?; + #[cfg(feature = "experimental_jq")] + Rc::make_mut(&mut l).append(&r)?; + #[cfg(not(feature = "experimental_jq"))] + { let a = Rc::make_mut(&mut l); a.extend(r.iter().cloned()); a.resync(); + } Ok(Arr(l)) } (Obj(mut l), Obj(r)) => { meter::check((l.len() + r.len()) * 3 * val_size)?; + #[cfg(feature = "experimental_jq")] + Rc::make_mut(&mut l).append(&r)?; + #[cfg(not(feature = "experimental_jq"))] + { let o = Rc::make_mut(&mut l); o.extend(r.iter().map(|(k, v)| (k.clone(), v.clone()))); o.resync(); + } Ok(Obj(l)) } (l, r) => Err(jqmsg::math(l, ops::Math::Add, r, false)), // BASHKIT PATCH @@ -785,10 +870,15 @@ impl core::ops::Sub for Val { match (self, rhs) { (Self::Num(x), Self::Num(y)) => Ok(Self::Num(x - y)), (Self::Arr(mut l), Self::Arr(r)) => { + #[cfg(feature = "experimental_jq")] + Rc::make_mut(&mut l).subtract(&r)?; + #[cfg(not(feature = "experimental_jq"))] + { let r = r.iter().collect::>(); let a = Rc::make_mut(&mut l); a.retain(|x| !r.contains(x)); a.resync(); // BASHKIT PATCH (TM-DOS-110) + } Ok(Self::Arr(l)) } (l, r) => Err(jqmsg::math(l, ops::Math::Sub, r, false)), // BASHKIT PATCH @@ -796,7 +886,8 @@ impl core::ops::Sub for Val { } } -fn obj_merge(l: &mut Rc>, r: Rc>) { +#[cfg(not(feature = "experimental_jq"))] +fn obj_merge(l: &mut Rc>, r: Rc>) { let l = Rc::make_mut(l); let r = rc_unwrap_or_clone(r).into_iter(); r.for_each(|(k, v)| match (l.get_mut(&k), v) { @@ -834,6 +925,9 @@ impl core::ops::Mul for Val { // (BStr(_) | TStr(_), Num(Int(_))) | (Num(Int(_)), BStr(_) | TStr(_)) => Ok(Null), (Obj(mut l), Obj(r)) => { + #[cfg(feature = "experimental_jq")] + super::owned::merge(&mut l, r)?; + #[cfg(not(feature = "experimental_jq"))] obj_merge(&mut l, r); Ok(Obj(l)) } @@ -914,6 +1008,9 @@ impl PartialOrd for Val { impl Ord for Val { fn cmp(&self, other: &Self) -> Ordering { + // BASHKIT PATCH: shared trees can amplify traversal without growth. + #[cfg(feature = "experimental_jq")] + meter::tick(); use Ordering::{Equal, Greater, Less}; match (self, other) { (Self::Null, Self::Null) => Equal, @@ -926,10 +1023,26 @@ impl Ord for Val { (0, _) => Less, (_, 0) => Greater, _ => { + // BASHKIT PATCH: charged scratch for owned comparisons. + #[cfg(feature = "experimental_jq")] + let mut l = super::owned::entries(x); + #[cfg(feature = "experimental_jq")] + let mut r = super::owned::entries(y); + #[cfg(not(feature = "experimental_jq"))] let mut l: Vec<_> = x.iter().collect(); + #[cfg(not(feature = "experimental_jq"))] let mut r: Vec<_> = y.iter().collect(); - l.sort_by_key(|(k, _v)| *k); - r.sort_by_key(|(k, _v)| *k); + // BASHKIT PATCH: unique keys permit allocation-free sort. + #[cfg(feature = "experimental_jq")] + { + l.sort_unstable_by_key(|(k, _v)| *k); + r.sort_unstable_by_key(|(k, _v)| *k); + } + #[cfg(not(feature = "experimental_jq"))] + { + l.sort_by_key(|(k, _v)| *k); + r.sort_by_key(|(k, _v)| *k); + } // TODO: make this nicer let kl = l.iter().map(|(k, _v)| k); let kr = r.iter().map(|(k, _v)| k); @@ -959,6 +1072,9 @@ impl Ord for Val { impl PartialEq for Val { fn eq(&self, other: &Self) -> bool { + // BASHKIT PATCH: keep equality interruptible independently of output. + #[cfg(feature = "experimental_jq")] + meter::tick(); match (self, other) { (Self::Null, Self::Null) => true, (Self::Bool(x), Self::Bool(y)) => x == y, @@ -975,6 +1091,9 @@ impl Eq for Val {} impl Hash for Val { fn hash(&self, state: &mut H) { + // BASHKIT PATCH: hashing can traverse an exponentially shared tree. + #[cfg(feature = "experimental_jq")] + meter::tick(); fn hash_with(u: u8, x: impl Hash, state: &mut impl Hasher) { state.write_u8(u); x.hash(state) @@ -989,7 +1108,14 @@ impl Hash for Val { Self::Obj(o) => { state.write_u8(7); // this is similar to what happens in `Val::cmp` + // BASHKIT PATCH: charge object-hash scratch in owned mode. + #[cfg(feature = "experimental_jq")] + let mut kvs = super::owned::entries(o); + #[cfg(not(feature = "experimental_jq"))] let mut kvs: Vec<_> = o.iter().collect(); + #[cfg(feature = "experimental_jq")] + kvs.sort_unstable_by_key(|(k, _v)| *k); + #[cfg(not(feature = "experimental_jq"))] kvs.sort_by_key(|(k, _v)| *k); kvs.iter().for_each(|(k, v)| (k, v).hash(state)); } diff --git a/crates/bashkit/src/builtins/jq/jaq_json/read.rs b/crates/bashkit/src/builtins/jq/jaq_json/read.rs index 1ab4bb94e..541af9902 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/read.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/read.rs @@ -133,24 +133,44 @@ fn parse_at(next: u8, lexer: &mut L, depth: usize) -> Result Val::Num(parse_num(lexer)?), b'"' => Val::utf8_str(parse_string(lexer.discarded(), false)?), b'[' => Val::Arr({ + // BASHKIT PATCH: incremental, charged construction in owned mode. + #[cfg(feature = "experimental_jq")] + let mut arr = super::super::owned::Container::>::default(); + #[cfg(not(feature = "experimental_jq"))] let mut arr = Vec::new(); lexer.discarded().seq(b']', ws_tk, |next, lexer| { + #[cfg(feature = "experimental_jq")] + arr.push(parse_at(next, lexer, depth + 1)?).map_err(|_| hifijson::Error::from(Expect::Value))?; + #[cfg(not(feature = "experimental_jq"))] arr.push(parse_at(next, lexer, depth + 1)?); Ok::<_, hifijson::Error>(()) })?; + #[cfg(feature = "experimental_jq")] + { super::Rc::new(arr) } + #[cfg(not(feature = "experimental_jq"))] super::metered(arr) }), - b'{' => Val::obj({ + b'{' => { + // BASHKIT PATCH: do not build an uncharged temporary object. + #[cfg(feature = "experimental_jq")] + let mut obj = super::super::owned::Container::::default(); + #[cfg(not(feature = "experimental_jq"))] let mut obj = Map::default(); lexer.discarded().seq(b'}', ws_tk, |next, lexer| { let key = parse_at(next, lexer, depth + 1)?; lexer.expect(ws_tk, b':').ok_or(Expect::Colon)?; let value = parse_at(ws_tk(lexer).ok_or(Expect::Value)?, lexer, depth + 1)?; + #[cfg(feature = "experimental_jq")] + obj.insert(key, value).map_err(|_| hifijson::Error::from(Expect::Value))?; + #[cfg(not(feature = "experimental_jq"))] obj.insert(key, value); Ok::<_, hifijson::Error>(()) })?; - obj - }), + #[cfg(feature = "experimental_jq")] + return Ok(Val::Obj(super::Rc::new(obj))); + #[cfg(not(feature = "experimental_jq"))] + Val::obj(obj) + }, _ => Err(Expect::Value)?, }) } diff --git a/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs b/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs new file mode 100644 index 000000000..951e668cb --- /dev/null +++ b/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs @@ -0,0 +1,34 @@ +use super::Val; +use crate::builtins::jq::jaq_json::meter; + +fn tree(mut leaf: Val) -> Val { + for _ in 0..13 { + leaf = [leaf.clone(), leaf].into_iter().collect(); + } + leaf +} + +fn assert_interrupted(operation: impl FnOnce()) { + let (_guard, _meter) = meter::install(1 << 20, Some(Box::new(|| true))); + let abort = std::panic::catch_unwind(std::panic::AssertUnwindSafe(operation)); + assert!(abort.is_err_and(|error| { + error.downcast_ref::() == Some(&meter::Abort::Interrupted) + })); +} + +#[test] +fn containment_polls_while_revisiting_shared_descendants() { + let left = tree(Val::Null); + let right = tree(Val::Null); + assert_interrupted(|| { + std::hint::black_box(left.contains(&right)); + }); +} + +#[test] +fn byte_conversion_polls_even_when_every_leaf_is_empty() { + let value = tree(std::iter::empty::().collect()); + assert_interrupted(|| { + let _ = std::hint::black_box(value.to_bytes()); + }); +} diff --git a/crates/bashkit/src/builtins/jq/jaq_json/write.rs b/crates/bashkit/src/builtins/jq/jaq_json/write.rs index 838187ed6..253626cac 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/write.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/write.rs @@ -194,6 +194,9 @@ macro_rules! style { /// yielding invalid UTF-8 characters as-is. macro_rules! format_val { ($w:ident, $pp:ident, $level:expr, $v:ident, $f:expr) => {{ + // BASHKIT PATCH: formatting is a separately interruptible lifecycle. + #[cfg(feature = "experimental_jq")] + $crate::builtins::jq::jaq_json::meter::tick(); macro_rules! color { ($style:ident, $g:expr) => {{ style!($w, $pp, $style, $g) @@ -239,8 +242,17 @@ macro_rules! format_val { } if !o.is_empty() { if $pp.sort_keys { + // BASHKIT PATCH: sorted rendering owns charged scratch. + #[cfg(feature = "experimental_jq")] + let mut o = $crate::builtins::jq::owned::entries(o); + #[cfg(not(feature = "experimental_jq"))] let mut o: std::vec::Vec<_> = o.iter().collect(); + #[cfg(feature = "experimental_jq")] + o.sort_unstable_by_key(|(k, _v)| *k); + #[cfg(not(feature = "experimental_jq"))] o.sort_by_key(|(k, _v)| *k); + #[cfg(feature = "experimental_jq")] + let o = o.into_charged_iter(); write_seq!($w, $pp, $level, o, |x| kv!(x)) } else { write_seq!($w, $pp, $level, &**o, |x| kv!(x)) diff --git a/crates/bashkit/src/builtins/jq/mod.rs b/crates/bashkit/src/builtins/jq/mod.rs index 4e5f677c3..c46cdb25b 100644 --- a/crates/bashkit/src/builtins/jq/mod.rs +++ b/crates/bashkit/src/builtins/jq/mod.rs @@ -41,6 +41,9 @@ mod format; mod input; mod loc; mod messages; +// Owned container boundary, deliberately opt-in while compatibility is tested. +#[cfg(feature = "experimental_jq")] +mod owned; // Vendored jaq-json (MIT, Michael Färber, https://github.com/01mf02/jaq), // see jaq_json/UPSTREAM_VERSION and knowledge/runtimes/jaq-json-vendor.md. // Kept byte-close to upstream so `scripts/sync-jaq-json.sh` can merge new @@ -334,6 +337,37 @@ async fn run_jq(ctx: Context<'_>, parsed: JqArgs<'_>) -> Result { .ok() }) .unwrap_or_else(|| ExecutionLimits::default().max_live_intermediate_bytes); + // The experimental safety boundary observes request cancellation even + // during synchronous evaluation that never returns to the async executor. + #[cfg(feature = "experimental_jq")] + let interruption = std::rc::Rc::new(std::cell::RefCell::new(None)); + #[cfg(feature = "experimental_jq")] + let stop = { + let deadline = deadline.clone(); + let budget = ctx.execution_budget(); + let interruption = interruption.clone(); + Some(Box::new(move || { + if deadline.as_ref().is_some_and(|deadline| { + deadline + .try_with(ExecutionDeadline::is_expired) + .unwrap_or(true) + }) { + return true; + } + if let Some(budget) = &budget { + let checked: Result<()> = budget + .try_with(|budget| budget.check()) + .map_err(|_| crate::Error::Cancelled) + .and_then(|result| result.map_err(Into::into)); + if let Err(error) = checked { + *interruption.borrow_mut() = Some(error); + return true; + } + } + false + }) as jaq_json::meter::StopCheck) + }; + #[cfg(not(feature = "experimental_jq"))] let stop = deadline.clone().map(|deadline| { Box::new(move || { deadline @@ -646,6 +680,10 @@ async fn run_jq(ctx: Context<'_>, parsed: JqArgs<'_>) -> Result { return size_error(&meter); } Some(jaq_json::meter::Abort::Interrupted) => { + #[cfg(feature = "experimental_jq")] + if let Some(error) = interruption.borrow_mut().take() { + return Err(error); + } return Ok(ExecResult::err("jq: execution timed out\n".to_string(), 5)); } Some(jaq_json::meter::Abort::Recursion) => { diff --git a/crates/bashkit/src/builtins/jq/owned.rs b/crates/bashkit/src/builtins/jq/owned.rs new file mode 100644 index 000000000..dd8ec0624 --- /dev/null +++ b/crates/bashkit/src/builtins/jq/owned.rs @@ -0,0 +1,239 @@ +//! Experimental Bashkit-owned container boundary. +//! +//! Decision: reuse jaq's language and native functions, but give them only +//! read access to container bodies. Every attachment and capacity change goes +//! through this API. No DerefMut, entry handle, or mutable child escapes it. +//! Keep the low-level meter shared with strings, streaming and cancellation. +//! THREAT[TM-DOS-027,TM-DOS-110]: admit depth before attachment, memory before +//! reserve/COW, and invalidate depth plus reconcile charges in the same method. + +use super::jaq_json::meter::{self, Footprint, Metered}; +use super::jaq_json::{Error, Map, Rc, Val, ValueDepth}; +use std::ops::Deref; + +/// A read-only body with checked, type-specific mutation operations. +#[derive(Debug, PartialEq, Eq, Hash)] +pub(super) struct Container { + body: Metered, +} + +impl Container { + pub(super) fn admit(mut body: Metered) -> Self { + if meter::check_depth(body.depth(ValueDepth::value_depth)).is_err() { + body = Metered::default(); // panic-abort: discard a rejected tree + } + Self { body } + } +} + +impl Container { + pub(super) fn depth(&self, compute: impl FnOnce(&T) -> usize) -> usize { + self.body.depth(compute) + } +} + +impl Clone for Container { + fn clone(&self) -> Self { + // Rc::make_mut invokes this before copying a shared body. + if !meter::require(self.body.footprint()) { + return Self::default(); // panic-abort: do not copy rejected storage + } + Self::admit(self.body.clone()) + } +} + +impl Default for Container { + fn default() -> Self { + Self::admit(Metered::default()) + } +} + +impl Deref for Container { + type Target = T; + + fn deref(&self) -> &T { + &self.body + } +} + +impl IntoIterator for Container { + type Item = T::Item; + type IntoIter = meter::OwnedIter; + + fn into_iter(self) -> Self::IntoIter { + self.body.into_charged_iter() + } +} + +impl<'a, T: Footprint> IntoIterator for &'a Container +where + &'a T: IntoIterator, +{ + type Item = <&'a T as IntoIterator>::Item; + type IntoIter = <&'a T as IntoIterator>::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + self.deref().into_iter() + } +} + +fn child(value: &Val) -> Result<(), Error> { + meter::tick(); + meter::check_depth(1 + value.value_depth()) +} + +impl Container> { + fn reserve(&mut self, len: usize) -> Result<(), Error> { + if len > self.body.capacity() { + let additional = len - self.body.capacity(); + meter::check(additional.saturating_mul(size_of::()))?; + let additional_len = len - self.body.len(); + self.body.reserve_exact(additional_len); + self.body.resync(); + } + Ok(()) + } + + pub(super) fn push(&mut self, value: Val) -> Result<(), Error> { + child(&value)?; + if self.len() == self.capacity() { + self.reserve(self.capacity().max(1).saturating_mul(2))?; + } + self.body.push(value); + Ok(()) + } + + pub(super) fn set(&mut self, index: usize, value: Val) -> Result<(), Error> { + child(&value)?; + self.reserve(index.saturating_add(1))?; + if index >= self.len() { + self.body.resize(index + 1, Val::Null); + } + self.body[index] = value; + Ok(()) + } + + pub(super) fn take(&mut self, index: usize) -> Val { + std::mem::take(&mut self.body[index]) + } + + pub(super) fn remove(&mut self, index: usize) { + self.body.remove(index); + } + + pub(super) fn splice(&mut self, skip: usize, take: usize, values: &Self) -> Result<(), Error> { + for value in values { + child(value)?; + } + self.reserve(self.len().saturating_sub(take).saturating_add(values.len()))?; + // Splice an exact-size iterator; no uncharged temporary Vec of clones. + self.body.splice(skip..skip + take, values.iter().cloned()); + self.body.resync(); + Ok(()) + } + + pub(super) fn append(&mut self, values: &Self) -> Result<(), Error> { + self.splice(self.len(), 0, values) + } + + pub(super) fn subtract(&mut self, values: &Self) -> Result<(), Error> { + // Keep the lookup index metered, with O(m log m + n log m) work. + // Sorting references in place needs no temporary value bodies. + meter::check(values.len().saturating_mul(size_of::<&Val>()))?; + let mut sorted = Metered::new(values.iter().collect::>()); + sorted.sort_unstable_by(|left, right| { + meter::tick(); + left.cmp(right) + }); + self.body.retain(|value| { + meter::tick(); + sorted.binary_search(&value).is_err() + }); + Ok(()) + } +} + +impl Container { + pub(super) fn insert(&mut self, key: Val, value: Val) -> Result<(), Error> { + child(&key)?; + child(&value)?; + if !self.body.contains_key(&key) && self.len() == self.capacity() { + // IndexMap chooses geometric capacities for its entry/index tables. + // Admit a conservative full replacement while the old body lives. + // Include IndexMap's minimum table allocation even at len == 0. + let capacity = self.len().saturating_add(1).next_power_of_two().max(4); + let bytes = capacity + .saturating_mul(2) + .saturating_mul(size_of::<(Val, Val)>() + 2 * size_of::()); + meter::check(bytes)?; + self.body.reserve(1); + self.body.resync(); + } + self.body.insert(key, value); + Ok(()) + } + + pub(super) fn take(&mut self, key: &Val) -> Option { + self.body.get_mut(key).map(std::mem::take) + } + + pub(super) fn remove(&mut self, key: &Val) { + self.body.swap_remove(key); + } + + pub(super) fn append(&mut self, values: &Self) -> Result<(), Error> { + for (key, value) in values { + self.insert(key.clone(), value.clone())?; + } + Ok(()) + } +} + +pub(super) fn array(iter: impl IntoIterator) -> Container> { + let mut array = Container::>::default(); + for value in iter { + if array.push(value).is_err() { + meter::require(usize::MAX); + break; // panic-abort: never continue consuming an unbounded iterator + } + } + array +} + +pub(super) fn object(iter: impl IntoIterator) -> Result { + let mut object = Container::::default(); + for (key, value) in iter { + if !matches!(key, Val::TStr(_) | Val::BStr(_)) { + // Keep jq's existing object-key diagnostic. + return super::jaq_json::invalid_object_key(&key); + } + object.insert(key, value)?; + } + Ok(Val::Obj(Rc::new(object))) +} + +/// Charged scratch for object ordering/hashing; references cannot mutate values. +pub(super) fn entries(object: &Container) -> Metered> { + if !meter::require(object.len().saturating_mul(size_of::<(&Val, &Val)>())) { + return Metered::default(); + } + Metered::new(object.iter().collect()) +} + +pub(super) fn merge(left: &mut Rc>, right: Rc>) -> Result<(), Error> { + let left = Rc::make_mut(left); + for (key, value) in super::jaq_json::rc_unwrap_or_clone(right) { + let value = match (left.take(&key), value) { + (Some(Val::Obj(mut left)), Val::Obj(right)) => { + merge(&mut left, right)?; + Val::Obj(left) + } + (_, value) => value, + }; + left.insert(key, value)?; + } + Ok(()) +} + +#[cfg(test)] +mod tests; diff --git a/crates/bashkit/src/builtins/jq/owned/tests.rs b/crates/bashkit/src/builtins/jq/owned/tests.rs new file mode 100644 index 000000000..d4876c488 --- /dev/null +++ b/crates/bashkit/src/builtins/jq/owned/tests.rs @@ -0,0 +1,164 @@ +use super::*; + +#[test] +fn refused_attachment_leaves_the_container_valid() { + let (_guard, meter) = meter::install(1 << 20, None); + let mut nested = Val::Null; + for _ in 0..meter::MAX_VALUE_DEPTH { + nested = std::iter::once(nested).collect(); + } + let mut array = Container::>::default(); + let abort = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let _ = array.push(nested); + })); + assert!(abort.is_err()); + assert!(meter.tripped()); + assert!(array.is_empty()); +} + +#[test] +fn failed_cow_does_not_copy_or_change_the_shared_body() { + let (_guard, meter) = meter::install(64, None); + let mut array = Rc::new(array(vec![Val::Null; 4])); + let shared = array.clone(); + assert_eq!(meter::headroom(), 0); + let abort = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let _ = Rc::make_mut(&mut array).set(0, Val::Bool(true)); + })); + assert!(abort.is_err()); + assert!(meter.tripped()); + assert!(Rc::ptr_eq(&array, &shared)); + assert!(matches!(shared[0], Val::Null)); +} + +#[test] +fn failed_object_growth_does_not_reserve_storage() { + let key = Val::utf8_str("key"); + // A first IndexMap allocation has more than one entry of capacity. + let (_guard, meter) = meter::install(128, None); + let mut object = Container::::default(); + // Once tripped, constructing an error string also aborts the run. + let abort = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let _ = object.insert(key, Val::Null); + })); + assert!(abort.is_err()); + assert!(meter.tripped()); + assert_eq!(object.capacity(), 0); + assert!(object.is_empty()); +} + +#[test] +fn removal_invalidates_depth_and_drop_refunds_storage() { + let (_guard, _meter) = meter::install(4096, None); + let initial = meter::headroom(); + { + let nested: Val = std::iter::once(Val::Null).collect(); + let mut values = array([nested]); + assert_eq!(values.depth(ValueDepth::value_depth), 2); + values.remove(0); + assert_eq!(values.depth(ValueDepth::value_depth), 1); + assert!(meter::headroom() < initial); + } + assert_eq!(meter::headroom(), initial); +} + +#[test] +fn owning_iterator_keeps_storage_charged_until_drop() { + let (_guard, _meter) = meter::install(4096, None); + let initial = meter::headroom(); + let values = array(vec![Val::Null; 4]); + let retained = meter::headroom(); + assert!(retained < initial); + let mut iter = values.into_iter(); + assert_eq!( + meter::headroom(), + retained, + "iterator still owns the buffer" + ); + let _ = iter.next(); + assert_eq!( + meter::headroom(), + retained, + "partial consumption keeps capacity" + ); + drop(iter); + assert_eq!(meter::headroom(), initial); +} + +#[tokio::test] +async fn synchronous_evaluation_observes_host_cancellation() { + let mut bash = crate::Bash::builder() + .limits(crate::ExecutionLimits::new().timeout(std::time::Duration::from_secs(5))) + .build(); + let token = bash.cancellation_token(); + let cancel = std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_millis(50)); + token.store(true, std::sync::atomic::Ordering::Relaxed); + }); + let start = std::time::Instant::now(); + let result = bash.exec("jq -n 'until(false; .)'").await; + cancel.join().unwrap(); + assert!(result.unwrap_err().to_string().contains("cancelled")); + assert!(start.elapsed() < std::time::Duration::from_secs(3)); + // The host owns resetting the shared flag before starting another request. + bash.cancellation_token() + .store(false, std::sync::atomic::Ordering::Relaxed); + let recovered = bash.exec("jq -n '1 + 1'").await.unwrap(); + assert_eq!(recovered.stdout, "2\n"); +} + +#[test] +fn collection_charges_capacity_before_advancing_the_iterator() { + let (_guard, _meter) = meter::install(64, None); + let abort = std::panic::catch_unwind(|| { + array((0..10).map(|index| { + if index == 4 { + assert_eq!(meter::headroom(), 0); + } + Val::Null + })); + }); + assert!(abort.is_err()); +} + +#[test] +fn lifecycle_traversals_poll_the_stop_check() { + use std::hash::{Hash, Hasher}; + + // Two separately built shared trees. Equality cannot use Rc identity to + // skip their descendants. Small enough to finish even without polling. + let tree = || { + let mut value = Val::Null; + for _ in 0..13 { + value = [value.clone(), value].into_iter().collect(); + } + value + }; + let left = tree(); + let right = tree(); + for operation in ["equality", "ordering", "hash", "format"] { + let (_guard, _meter) = meter::install(1 << 20, Some(Box::new(|| true))); + let abort = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| match operation { + "equality" => { + std::hint::black_box(left == right); + } + "ordering" => { + std::hint::black_box(left.cmp(&right)); + } + "hash" => { + let mut hash = std::collections::hash_map::DefaultHasher::new(); + left.hash(&mut hash); + std::hint::black_box(hash.finish()); + } + _ => { + std::hint::black_box(left.to_string()); + } + })); + assert!( + abort + .is_err_and(|error| error.downcast_ref::() + == Some(&meter::Abort::Interrupted)), + "{operation} did not poll cancellation" + ); + } +} diff --git a/crates/bashkit/src/builtins/jq/tests.rs b/crates/bashkit/src/builtins/jq/tests.rs index db094f9a5..bfc11cfbe 100644 --- a/crates/bashkit/src/builtins/jq/tests.rs +++ b/crates/bashkit/src/builtins/jq/tests.rs @@ -1604,6 +1604,27 @@ mod differential { use super::*; + #[cfg(feature = "experimental_jq")] + #[tokio::test] + async fn diff_owned_container_lifecycle() { + for filter in [ + "[range(30)] | .[40] = 7 | .[0] |= empty | .[1:4] = [8,9]", + "[range(30)] as $old | [$old, ($old | .[3] = 100), $old]", + r#"{a:{b:1},c:2} as $old | [$old, ($old * {a:{d:3},e:4}), $old]"#, + r#"{a:1,b:2,c:3} | .b |= empty | .d = [true] | .a += 3"#, + r#"{a:[1],b:[2]} | .[] |= (. + [3])"#, + "([1,2,3] + [3,4,5]) - [3,5]", + "reduce range(100) as $i ({}; .[($i|tostring)] = [$i]) | to_entries | length", + "[range(20)] | tostring | fromjson | reverse | sort | unique", + "reduce range(40) as $i (0; [.]) | [.,.] | .[0] == .[1]", + "reduce range(40) as $i (0; {a:.}) | paths(scalars) | length", + r#"try ({a:1} | .a |= error("failed")) catch ."#, + r#"null as $key | try {($key):1} catch ."#, + ] { + assert_matches(&["-nc", filter], "").await; + } + } + #[tokio::test] async fn diff_stream_token_events_and_partial_errors() { for text in [ diff --git a/crates/bashkit/tests/integration/jq_value_depth_tests.rs b/crates/bashkit/tests/integration/jq_value_depth_tests.rs index b9b1215a2..20dc1264b 100644 --- a/crates/bashkit/tests/integration/jq_value_depth_tests.rs +++ b/crates/bashkit/tests/integration/jq_value_depth_tests.rs @@ -95,6 +95,46 @@ fn jq_sources(dir: &Path, out: &mut Vec) { /// /// See knowledge/runtimes/jaq-json-vendor.md, "Structural depth (#3013)". const REVIEWED: &[(&str, &str)] = &[ + // Object-wide updates collect into an already checked owned body. + ("jaq_json/mod.rs", "return Ok(Self::Obj(Rc::new(body)));"), + // Per-run interruption reason, not value container storage. + ( + "mod.rs", + "let interruption = std::rc::Rc::new(std::cell::RefCell::new(None));", + ), + // Experimental body admission. The owned type has no mutable dereference; + // these callers can only invoke its checked attachment operations. + ("jaq_json/mod.rs", "return Rc::new(Container::admit(body));"), + ("jaq_json/mod.rs", "let o = Rc::make_mut(o);"), + ("jaq_json/mod.rs", "Rc::make_mut(a).set(i, y)?;"), + ("jaq_json/mod.rs", "let a = Rc::make_mut(a);"), + ( + "jaq_json/mod.rs", + "Rc::make_mut(a).splice(skip, take, &y)?;", + ), + ( + "jaq_json/mod.rs", + "return Self::Arr(Rc::new(super::owned::array(iter)));", + ), + ("jaq_json/mod.rs", "Rc::make_mut(&mut l).append(&r)?;"), + ("jaq_json/mod.rs", "Rc::make_mut(&mut l).append(&r)?;"), + ("jaq_json/mod.rs", "Rc::make_mut(&mut l).subtract(&r)?;"), + ("jaq_json/read.rs", "{ super::Rc::new(arr) }"), + ( + "jaq_json/read.rs", + "return Ok(Val::Obj(super::Rc::new(obj)));", + ), + // Private mutable access stays inside owned.rs, where take replaces a + // child with null; insertion checks depth before restoring a child. + ("owned.rs", "Ok(Val::Obj(Rc::new(object)))"), + ("owned.rs", "let left = Rc::make_mut(left);"), + // Subtraction's read-only search index, pre-admitted and charged. + ( + "owned.rs", + "let mut sorted = Metered::new(values.iter().collect::>());", + ), + // Ordering/hash scratch holds immutable references, pre-admitted by entries. + ("owned.rs", "Metered::new(object.iter().collect())"), // Admission itself. ("jaq_json/mod.rs", "admit_container(Metered::new(t))"), ("jaq_json/mod.rs", "Rc::new(body)"), diff --git a/knowledge/operations/dependencies.md b/knowledge/operations/dependencies.md index ea8689e57..47bed4715 100644 --- a/knowledge/operations/dependencies.md +++ b/knowledge/operations/dependencies.md @@ -418,6 +418,10 @@ worth keeping so the question does not get re-litigated from scratch. `foldhash`, held at `0.2` against upstream's `^0.1` so the build links one copy instead of two (`hashbrown` requires 0.2). See [Vendored jaq-json](../runtimes/jaq-json-vendor.md) for the sync procedure. + `experimental_jq` opts into Bashkit-owned checked array/object containers + around the shared memory meter. jaq-core and jaq-std remain dependencies; + ownership of this value/resource boundary is independent of language parsing + and evaluation. The established `jq` feature keeps its current storage path. ## Gate rather than reimplement diff --git a/knowledge/runtimes/jaq-json-vendor.md b/knowledge/runtimes/jaq-json-vendor.md index ac4cc9a6b..7a384d3d7 100644 --- a/knowledge/runtimes/jaq-json-vendor.md +++ b/knowledge/runtimes/jaq-json-vendor.md @@ -37,6 +37,76 @@ copy can go back to being a dependency. ## Layout +### Experimental owned boundary + +`experimental_jq` is an opt-in Cargo feature on `bashkit` and `bashkit-cli`. +It implies `jq`; no default or existing feature enables it. Both jq and yq +use the selected value runtime. The first owned layer is array/object storage +in `builtins/jq/owned.rs`, compiled and linted as Bashkit code outside the +vendored module. This deliberately reuses jaq's parser, evaluator, standard +library, value arithmetic and Bashkit's compatibility definitions. It is not +a replacement jq language implementation or a performance claim. + +The [first paired benchmark](../../crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md) +records about 9% overhead for array updates and 13% for object updates in an +exploratory single pair. Keep the feature disabled by default; these results +do not establish a speedup. + +`Val` selects `Container` instead of raw `Metered` bodies under the +feature. Its private body and immutable `Deref` prohibit mutable entry handles, +mutable child references and unchecked growth. Type-specific set, insert, +splice, append, remove and merge operations check child depth before attachment, +invalidate depth on mutation, admit capacity growth before reserve, and resync +charges before returning. COW cloning admits the copied body before allocation. +Array/object collection, `fromjson`, input/global conversion and whole-object +updates build incrementally charged containers. Subtraction uses a charged +sorted reference index. The low-level meter and +string representation remain shared with the established path. Conservative +map-growth admission can fail earlier near the byte limit; resource-limit +differences are explicit exceptions to real-jq compatibility. + +Consuming a body transfers its storage charge to its owning iterator. Partial +consumption, exhaustion without dropping the iterator, early errors and unwind +must retain/refund that charge with the underlying buffer, rather than refunding +as soon as the body is converted into an iterator. + +The experiment also polls the shared stop check during value equality, +ordering, hashing, containment, byte conversion and formatting. Depth-bounded +shared trees can still require exponential traversal; a nesting bound alone +does not make those operations interruptible. Deterministic stop-check tests +use small independently constructed shared trees, so a polling regression +fails without hanging the test process. Object ordering/hashing scratch +storage is admitted and charged for its lifetime. + +Evaluator safety remains a separate boundary: `InputDataRef::clone` caps live +contexts and polls the execution deadline, while value operations poll the +same stop check. In experimental builds the stop check also checks the shared +request budget for cancellation, closed requests and prior budget failures; +the typed request error survives the unwind instead of becoming a timeout. +This experiment does not replace the evaluator controls or remove +the `panic = "unwind"` requirement for in-process interruption. A future +evaluator replacement needs its own audit and lifecycle tests. + +Run the same jq differential, depth, memory, cancellation, streaming and yq +suites with `jq` and with `experimental_jq`. Owned API unit tests additionally +pin rejection before COW, pre-attachment depth checks, incremental capacity +charging, owning-iterator retention, release on drop and cancellation during a +synchronous non-emitting loop followed by session recovery. +The host resets its cancellation token before that next request, as required +by the public token contract. +`diff_owned_container_lifecycle` compares +construction, mutation/COW, merge, traversal, comparison, formatting and error +cleanup with real jq. CI exercises the experimental configuration separately. +Keep vendor sync patches at the selection/call sites; `owned.rs` is maintained +by Bashkit rather than overwritten from upstream. + +```bash +cargo test -p bashkit --no-default-features --features experimental_jq --lib --test integration -- jq yq +cargo bench -p bashkit --no-default-features --features experimental_jq --bench jq +# From crates/bashkit/fuzz, with cargo-fuzz and a supported nightly: +cargo +nightly fuzz run jq_fuzz --features experimental_jq +``` + | Path | Content | |---|---| | `jaq_json/*.rs`, `defs.jq` | Upstream sources, mechanically adapted (below) plus `BASHKIT PATCH` hunks | diff --git a/knowledge/security/security-testing.md b/knowledge/security/security-testing.md index 22542adc9..85e16fc2e 100644 --- a/knowledge/security/security-testing.md +++ b/knowledge/security/security-testing.md @@ -57,6 +57,13 @@ and TM-DOS-023 in the [Threat Model](threat-model.md). ## jq generated structure depth +The opt-in `experimental_jq` owned-container runtime runs the same jq/yq +compatibility and resource regression suites. Its additional API tests cover +pre-copy COW admission, refused child attachment, exact depth invalidation, +incremental charging and drop refunds. Its mutation differential corpus uses +real jq as the oracle, with memory/depth limits as deliberate exceptions. +See [Vendored jaq-json](../runtimes/jaq-json-vendor.md#experimental-owned-boundary). + `memory_growth_security_tests::jq` checks depth 100/101 independently of heap, output and evaluator recursion limits. It covers new containers, index updates, slice updates, shared subtrees, removal/COW cache invalidation, `fromjson`, diff --git a/knowledge/security/threat-model.md b/knowledge/security/threat-model.md index 3cafef002..a94964236 100644 --- a/knowledge/security/threat-model.md +++ b/knowledge/security/threat-model.md @@ -347,6 +347,14 @@ panicked. Resolved with `wrapping_*` ops, masked shift amounts, clamped exponent **Implementation**: `timeout` 30s + `parser_timeout` 5s + `max_parser_operations` 100K in `limits.rs` (TM-DOS-023/024); `AWK_MAX_PARSER_DEPTH` 100 (`builtins/awk/parser.rs`) and `MAX_JQ_JSON_DEPTH` 100 (`builtins/jq/`) for TM-DOS-027; `MAX_LCS_CELLS` 10M (`builtins/diff.rs`) for TM-DOS-028. +The opt-in `experimental_jq` value boundary centralizes array/object depth, +capacity and COW checks in an API with no mutable body access. Lifecycle +traversals also poll interruption, since small shared trees can require very +large comparison/hash/format work. jaq parser/evaluator controls remain +separate and unchanged. See +[experimental owned boundary](../runtimes/jaq-json-vendor.md#experimental-owned-boundary) +for ownership scope, limit exceptions, tests and the unwind requirement. + --- ### 2. Sandbox Escape diff --git a/site/src/data/performance-timeline.json b/site/src/data/performance-timeline.json index 687b8d9a3..cb727ca9b 100644 --- a/site/src/data/performance-timeline.json +++ b/site/src/data/performance-timeline.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-11-25T04:20:03.000Z", + "generatedAt": "2026-11-25T20:50:28.000Z", "sources": { "bench": "crates/bashkit-bench/results/*.json", "criterion": "crates/bashkit/benches/results/*.md", @@ -9,7 +9,7 @@ }, "summary": { "benchRuns": 17, - "criterionRuns": 28, + "criterionRuns": 29, "evalRuns": 58, "latestBench": { "id": "bench-454522b0b8c5-linux-x86_64-1795580000", @@ -2996,6 +2996,30 @@ "us": 58.1 }, "bestImprovement": null + }, + { + "id": "criterion-jq-owned-cloud-linux-x86_64-1795639828", + "kind": "criterion", + "family": "jq", + "label": "Criterion jq Experimental Owned Containers", + "date": "2026-11-25", + "timestamp": "2026-11-25T20:50:28.000Z", + "source": "crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md", + "reportSource": "crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md", + "cases": 8, + "medianUs": 6154.5, + "p95Us": 31649.3, + "medianChangePct": 0, + "meanChangePct": 1.8, + "bestChangePct": -6.8, + "fastestCase": { + "name": "`jq/single_lookup`", + "us": 577 + }, + "bestImprovement": { + "name": "`jq/interleaved_filters`", + "changePct": -6.8 + } } ], "evalRuns": [ @@ -10856,6 +10880,15 @@ "detail": "single_bash_new at 58.1 us median", "metric": 9875.3, "source": "crates/bashkit/benches/results/criterion-parallel-454522b0b8c5-linux-x86_64-1795580403.md" + }, + { + "date": "2026-11-25", + "timestamp": "2026-11-25T20:50:28.000Z", + "kind": "Criterion", + "title": "jq", + "detail": "6.8% faster in `jq/interleaved_filters`", + "metric": 0, + "source": "crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md" } ] } From de7385efde09c5e218b7e0a529143fbf30a4d1ed Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 15:33:07 -0600 Subject: [PATCH 02/12] fix(jq): interrupt shared-tree traversal in both backends --- .../bashkit/src/builtins/jq/jaq_json/funs.rs | 4 +- .../bashkit/src/builtins/jq/jaq_json/mod.rs | 3 -- .../builtins/jq/jaq_json/tests/lifecycle.rs | 19 ++++++++ .../bashkit/src/builtins/jq/jaq_json/write.rs | 1 - .../tests/integration/bounded_child.rs | 45 ++++++++++++++++++- .../tests/integration/jq_value_depth_tests.rs | 37 ++++++++++++++- knowledge/runtimes/jaq-json-vendor.md | 5 ++- knowledge/security/threat-model.md | 4 +- 8 files changed, 105 insertions(+), 13 deletions(-) diff --git a/crates/bashkit/src/builtins/jq/jaq_json/funs.rs b/crates/bashkit/src/builtins/jq/jaq_json/funs.rs index 010c25ade..ee6758d32 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/funs.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/funs.rs @@ -61,7 +61,6 @@ impl Val { /// * `a` equals `b`. fn contains(&self, other: &Self) -> bool { // BASHKIT PATCH: shared generated trees need traversal interruption. - #[cfg(feature = "experimental_jq")] super::meter::tick(); match (self, other) { (Self::BStr(l), Self::BStr(r)) | (Self::TStr(l), Self::TStr(r)) => l.contains_str(&**r), @@ -75,7 +74,6 @@ impl Val { fn to_bytes(&self) -> Result { // BASHKIT PATCH: poll even while recursively traversing empty leaves. - #[cfg(feature = "experimental_jq")] super::meter::tick(); match self { Val::Num(n) => n @@ -202,6 +200,6 @@ fn base DataT = Val>>() -> Box<[Filter>]> { } // BASHKIT PATCH: bounded regressions for traversal with no output or growth. -#[cfg(all(test, feature = "experimental_jq"))] +#[cfg(test)] #[path = "tests/lifecycle.rs"] mod lifecycle_tests; diff --git a/crates/bashkit/src/builtins/jq/jaq_json/mod.rs b/crates/bashkit/src/builtins/jq/jaq_json/mod.rs index 5efa9bc44..c6369d854 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/mod.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/mod.rs @@ -1009,7 +1009,6 @@ impl PartialOrd for Val { impl Ord for Val { fn cmp(&self, other: &Self) -> Ordering { // BASHKIT PATCH: shared trees can amplify traversal without growth. - #[cfg(feature = "experimental_jq")] meter::tick(); use Ordering::{Equal, Greater, Less}; match (self, other) { @@ -1073,7 +1072,6 @@ impl Ord for Val { impl PartialEq for Val { fn eq(&self, other: &Self) -> bool { // BASHKIT PATCH: keep equality interruptible independently of output. - #[cfg(feature = "experimental_jq")] meter::tick(); match (self, other) { (Self::Null, Self::Null) => true, @@ -1092,7 +1090,6 @@ impl Eq for Val {} impl Hash for Val { fn hash(&self, state: &mut H) { // BASHKIT PATCH: hashing can traverse an exponentially shared tree. - #[cfg(feature = "experimental_jq")] meter::tick(); fn hash_with(u: u8, x: impl Hash, state: &mut impl Hasher) { state.write_u8(u); diff --git a/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs b/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs index 951e668cb..e511439bc 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/tests/lifecycle.rs @@ -32,3 +32,22 @@ fn byte_conversion_polls_even_when_every_leaf_is_empty() { let _ = std::hint::black_box(value.to_bytes()); }); } + +#[test] +fn comparison_hashing_and_formatting_poll_shared_trees() { + use std::hash::{Hash, Hasher}; + let left = tree(Val::Null); + let right = tree(Val::Null); + for operation in ["equality", "ordering", "hash", "format"] { + assert_interrupted(|| match operation { + "equality" => { std::hint::black_box(left == right); } + "ordering" => { std::hint::black_box(left.cmp(&right)); } + "hash" => { + let mut hash = std::collections::hash_map::DefaultHasher::new(); + left.hash(&mut hash); + std::hint::black_box(hash.finish()); + } + _ => { std::hint::black_box(left.to_string()); } + }); + } +} diff --git a/crates/bashkit/src/builtins/jq/jaq_json/write.rs b/crates/bashkit/src/builtins/jq/jaq_json/write.rs index 253626cac..7847dad62 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/write.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/write.rs @@ -195,7 +195,6 @@ macro_rules! style { macro_rules! format_val { ($w:ident, $pp:ident, $level:expr, $v:ident, $f:expr) => {{ // BASHKIT PATCH: formatting is a separately interruptible lifecycle. - #[cfg(feature = "experimental_jq")] $crate::builtins::jq::jaq_json::meter::tick(); macro_rules! color { ($style:ident, $g:expr) => {{ diff --git a/crates/bashkit/tests/integration/bounded_child.rs b/crates/bashkit/tests/integration/bounded_child.rs index cba347144..70af51b81 100644 --- a/crates/bashkit/tests/integration/bounded_child.rs +++ b/crates/bashkit/tests/integration/bounded_child.rs @@ -18,7 +18,8 @@ //! path of a child test; the child test returns immediately unless that env //! var is set, then runs its body on [`EMBEDDING_STACK`] via [`on_small_stack`]. -// The launcher is unix-only; the child helpers are shared by every platform. +// Unix adds CPU, stack and RSS bounds; other hosts keep the wall/output +// watchdog for bounded-allocation depth regressions such as jq's #3013. #![cfg_attr(not(unix), allow(dead_code, unused_imports))] use std::io::Read; @@ -157,6 +158,48 @@ pub fn is_child(env: &str) -> bool { std::env::var_os(env).is_some() } +/// Supervise bounded-allocation stack regressions on native non-Unix hosts. +/// Child bodies still use EMBEDDING_STACK; only Unix provides OS CPU/RSS caps. +#[cfg(not(unix))] +pub fn run(label: &str, env: &str, exact_test: &str) { + let mut child = Command::new(std::env::current_exe().unwrap()) + .args(["--exact", exact_test, "--nocapture", "--test-threads=1"]) + .env(env, "1") + .env("LLVM_PROFILE_FILE", bashkit::testing::child_profile_path()) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("spawn bounded child"); + let exceeded = Arc::new(AtomicBool::new(false)); + let stdout = drain(child.stdout.take().unwrap(), exceeded.clone()); + let stderr = drain(child.stderr.take().unwrap(), exceeded.clone()); + let start = Instant::now(); + let status = loop { + if let Some(status) = child.try_wait().unwrap() { + break status; + } + if exceeded.load(Ordering::Relaxed) || start.elapsed() > Duration::from_secs(20) { + child.kill().unwrap(); + let _ = child.wait(); + panic!("{label}: child exceeded wall/output bounds"); + } + std::thread::sleep(Duration::from_millis(10)); + }; + let stdout = stdout.join().unwrap(); + let stderr = stderr.join().unwrap(); + assert!( + status.success() && !exceeded.load(Ordering::Relaxed), + "{label}: child status {status}: {}{}", + String::from_utf8_lossy(&stdout), + String::from_utf8_lossy(&stderr) + ); + assert!( + String::from_utf8_lossy(&stdout).contains("1 passed"), + "{label}: child test did not run" + ); +} + /// Run an async body on a fresh current-thread runtime, on a thread with the /// typical embedding stack size. pub fn on_small_stack(body: F) diff --git a/crates/bashkit/tests/integration/jq_value_depth_tests.rs b/crates/bashkit/tests/integration/jq_value_depth_tests.rs index 20dc1264b..0844d89f0 100644 --- a/crates/bashkit/tests/integration/jq_value_depth_tests.rs +++ b/crates/bashkit/tests/integration/jq_value_depth_tests.rs @@ -22,9 +22,44 @@ use super::bounded_child; const CHILD: &str = "BASHKIT_JQ_VALUE_DEPTH_CHILD"; const DEPTH_ERROR: &str = "jq: error: value nesting depth limit (100) exceeded\n"; +const TRAVERSAL_CHILD: &str = "BASHKIT_JQ_TRAVERSAL_CHILD"; + +#[test] +fn lifecycle_traversals_bounded() { + bounded_child::run( + "jq-traversal", + TRAVERSAL_CHILD, + "jq_value_depth_tests::lifecycle_traversals_child", + ); +} + +#[test] +fn lifecycle_traversals_child() { + if !bounded_child::is_child(TRAVERSAL_CHILD) { + return; + } + bounded_child::on_small_stack(|| async { + let mut bash = bashkit::Bash::builder() + .limits(bashkit::ExecutionLimits::new().timeout(std::time::Duration::from_millis(250))) + .build(); + let prefix = "def tree: reduce range(60) as $i (null; [.,.]); tree as $a | tree as $b | "; + for filter in [ + format!("{prefix}$a == $b"), + format!("{prefix}[$a,$b] | sort | length"), + format!("{prefix}$a | contains($b)"), + "reduce range(60) as $i ([]; [.,.]) | tobytes | length".into(), + ] { + let result = bash.exec(&format!("jq -n '{filter}'")).await.unwrap(); + assert_eq!(result.exit_code, 5, "{filter}: {}", result.stderr); + assert_eq!(result.stderr, "jq: execution timed out\n", "{filter}"); + let recovered = bash.exec("jq -n '1 + 1'").await.unwrap(); + assert_eq!(recovered.stdout, "2\n"); + assert!(recovered.stderr.is_empty()); + } + }); +} #[test] -#[cfg(unix)] fn generated_depth_bounded() { bounded_child::run( "jq-depth", diff --git a/knowledge/runtimes/jaq-json-vendor.md b/knowledge/runtimes/jaq-json-vendor.md index 7a384d3d7..cfe5b60ae 100644 --- a/knowledge/runtimes/jaq-json-vendor.md +++ b/knowledge/runtimes/jaq-json-vendor.md @@ -70,12 +70,13 @@ consumption, exhaustion without dropping the iterator, early errors and unwind must retain/refund that charge with the underlying buffer, rather than refunding as soon as the body is converted into an iterator. -The experiment also polls the shared stop check during value equality, +Both backends poll the shared stop check during value equality, ordering, hashing, containment, byte conversion and formatting. Depth-bounded shared trees can still require exponential traversal; a nesting bound alone does not make those operations interruptible. Deterministic stop-check tests use small independently constructed shared trees, so a polling regression -fails without hanging the test process. Object ordering/hashing scratch +fails without hanging the test process. A supervised child also verifies real +timeouts and recovery for 60-level shared DAGs on both backends. Owned object ordering/hashing scratch storage is admitted and charged for its lifetime. Evaluator safety remains a separate boundary: `InputDataRef::clone` caps live diff --git a/knowledge/security/threat-model.md b/knowledge/security/threat-model.md index a94964236..b636557a0 100644 --- a/knowledge/security/threat-model.md +++ b/knowledge/security/threat-model.md @@ -348,8 +348,8 @@ panicked. Resolved with `wrapping_*` ops, masked shift amounts, clamped exponent **Implementation**: `timeout` 30s + `parser_timeout` 5s + `max_parser_operations` 100K in `limits.rs` (TM-DOS-023/024); `AWK_MAX_PARSER_DEPTH` 100 (`builtins/awk/parser.rs`) and `MAX_JQ_JSON_DEPTH` 100 (`builtins/jq/`) for TM-DOS-027; `MAX_LCS_CELLS` 10M (`builtins/diff.rs`) for TM-DOS-028. The opt-in `experimental_jq` value boundary centralizes array/object depth, -capacity and COW checks in an API with no mutable body access. Lifecycle -traversals also poll interruption, since small shared trees can require very +capacity and COW checks in an API with no mutable body access. Both storage +backends poll interruption during lifecycle traversals, since small shared trees can require very large comparison/hash/format work. jaq parser/evaluator controls remain separate and unchanged. See [experimental owned boundary](../runtimes/jaq-json-vendor.md#experimental-owned-boundary) From 0fd4949ea810008aa162f6542cf05ea385d7e544 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 15:45:55 -0600 Subject: [PATCH 03/12] perf(jq): amortize checked growth and streamline object updates --- crates/bashkit/benches/jq.rs | 56 +++++ .../bashkit/src/builtins/jq/jaq_json/meter.rs | 24 ++- .../bashkit/src/builtins/jq/jaq_json/mod.rs | 7 +- crates/bashkit/src/builtins/jq/owned.rs | 104 ++++++--- crates/bashkit/src/builtins/jq/owned/tests.rs | 203 ++++++++++++++---- crates/bashkit/src/builtins/jq/tests.rs | 7 +- 6 files changed, 318 insertions(+), 83 deletions(-) diff --git a/crates/bashkit/benches/jq.rs b/crates/bashkit/benches/jq.rs index a299f5405..0d888ab7e 100644 --- a/crates/bashkit/benches/jq.rs +++ b/crates/bashkit/benches/jq.rs @@ -99,6 +99,62 @@ fn bench_jq(c: &mut Criterion) { ), 1, ), + ( + "array_copy_on_write", + ( + "jq -nc '[range(4096)] as $base | [range(64) as $i | $base | .[0] = $i | length] | add'".into(), + "262144\n".into(), + ), + 1, + ), + ( + "object_copy_on_write", + ( + "jq -nc '(reduce range(1024) as $i ({}; .[$i|tostring] = $i)) as $base | [range(64) as $i | $base | .a = $i | length] | add'".into(), + "65600\n".into(), + ), + 1, + ), + ( + "array_concat", + ( + "jq -n 'reduce range(1024) as $i ([]; . + [1,2,3]) | length'".into(), + "3072\n".into(), + ), + 1, + ), + ( + "object_merge", + ( + "jq -n 'reduce range(1024) as $i ({}; .[$i|tostring] = {a:$i}) | . * {\"0\":{b:3}} | length'".into(), + "1024\n".into(), + ), + 1, + ), + ( + "sort_unique", + ( + "jq -n '[range(4096) | . % 257] | sort | unique | length'".into(), + "257\n".into(), + ), + 1, + ), + ( + "json_round_trip", + ( + "jq -n '[range(4096)] | tojson | fromjson | add'".into(), + "8386560\n".into(), + ), + 1, + ), + ( + "join_8192", + ( + "jq -n '[range(8192) | tostring] | join(\",\") | length'".into(), + "39849\n".into(), + ), + 1, + ), ]; for (name, (script, expected), calls) in &cases { group.throughput(Throughput::Elements(*calls as u64)); diff --git a/crates/bashkit/src/builtins/jq/jaq_json/meter.rs b/crates/bashkit/src/builtins/jq/jaq_json/meter.rs index b65fa2b9b..82e378226 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/meter.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/meter.rs @@ -29,7 +29,7 @@ //! Builds with `panic = "abort"` cannot unwind: there the meter only trips //! and values are cut short, and a non-emitting loop is not interrupted. -use std::cell::RefCell; +use std::cell::{Cell, RefCell}; use std::ops::{Deref, DerefMut}; use std::sync::Arc; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; @@ -68,18 +68,21 @@ pub enum Abort { struct Poll { stop: StopCheck, - ticks: usize, } thread_local! { static CURRENT: RefCell>> = const { RefCell::new(None) }; static POLL: RefCell> = const { RefCell::new(None) }; + // BASHKIT PATCH: the hot path touches one Cell, borrowing the callback only + // at a poll boundary. Guard restoration preserves nested-run progress. + static TICKS: Cell = const { Cell::new(0) }; } /// Restores the previously installed meter when dropped. pub struct MeterGuard { prev: Option>, prev_poll: Option, + prev_ticks: usize, } impl Drop for MeterGuard { @@ -87,6 +90,7 @@ impl Drop for MeterGuard { let prev = self.prev.take(); CURRENT.with(|c| *c.borrow_mut() = prev); let prev_poll = self.prev_poll.take(); + TICKS.with(|ticks| ticks.set(self.prev_ticks)); POLL.with(|p| *p.borrow_mut() = prev_poll); } } @@ -101,9 +105,10 @@ pub fn install(limit: usize, stop: Option) -> (MeterGuard, Arc depth_exceeded: AtomicBool::new(false), }); let prev = CURRENT.with(|c| c.borrow_mut().replace(meter.clone())); - let poll = stop.map(|stop| Poll { stop, ticks: 0 }); + let poll = stop.map(|stop| Poll { stop }); let prev_poll = POLL.with(|p| core::mem::replace(&mut *p.borrow_mut(), poll)); - (MeterGuard { prev, prev_poll }, meter) + let prev_ticks = TICKS.with(|ticks| ticks.replace(0)); + (MeterGuard { prev, prev_poll, prev_ticks }, meter) } /// Stop the run now. Only returns in `panic = "abort"` builds, where the @@ -125,12 +130,13 @@ pub fn abort_recursion() { /// Count one value operation; poll the stop check now and then. pub fn tick() { - let stop = POLL.with(|p| { - let mut p = p.borrow_mut(); - let Some(poll) = p.as_mut() else { return false }; - poll.ticks += 1; - poll.ticks.is_multiple_of(TICKS_PER_POLL) && (poll.stop)() + let due = TICKS.with(|ticks| { + let next = ticks.get().wrapping_add(1); + ticks.set(next); + next.is_multiple_of(TICKS_PER_POLL) }); + if !due { return; } + let stop = POLL.with(|p| p.borrow().as_ref().is_some_and(|poll| (poll.stop)())); if stop { abort(Abort::Interrupted); } diff --git a/crates/bashkit/src/builtins/jq/jaq_json/mod.rs b/crates/bashkit/src/builtins/jq/jaq_json/mod.rs index c6369d854..e9a4edbc9 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/mod.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/mod.rs @@ -474,12 +474,7 @@ impl Val { #[cfg(feature = "experimental_jq")] { let o = Rc::make_mut(o); - let old = o.take(index).unwrap_or_default(); - if let Some(value) = f(old).next().transpose()? { - o.insert(index.clone(), value)?; - } else { - o.remove(index); - } + o.update(index.clone(), |old| f(old).next().transpose())?; } #[cfg(not(feature = "experimental_jq"))] { diff --git a/crates/bashkit/src/builtins/jq/owned.rs b/crates/bashkit/src/builtins/jq/owned.rs index dd8ec0624..688c30ed1 100644 --- a/crates/bashkit/src/builtins/jq/owned.rs +++ b/crates/bashkit/src/builtins/jq/owned.rs @@ -38,7 +38,11 @@ impl Clone for Container { if !meter::require(self.body.footprint()) { return Self::default(); // panic-abort: do not copy rejected storage } - Self::admit(self.body.clone()) + // A copy of an admitted body has the same children and depth. Scanning + // it again adds linear work immediately before COW invalidates depth. + Self { + body: self.body.clone(), + } } } @@ -85,9 +89,21 @@ fn child(value: &Val) -> Result<(), Error> { impl Container> { fn reserve(&mut self, len: usize) -> Result<(), Error> { if len > self.body.capacity() { - let additional = len - self.body.capacity(); + // Keep append-by-index amortized, while admitting exact growth + // when the geometric spare capacity would exceed the byte budget. + let geometric = len.max(self.body.capacity().max(1).saturating_mul(2)); + let capacity = if geometric + .saturating_sub(self.body.capacity()) + .saturating_mul(size_of::()) + <= meter::headroom() + { + geometric + } else { + len + }; + let additional = capacity - self.body.capacity(); meter::check(additional.saturating_mul(size_of::()))?; - let additional_len = len - self.body.len(); + let additional_len = capacity - self.body.len(); self.body.reserve_exact(additional_len); self.body.resync(); } @@ -97,7 +113,7 @@ impl Container> { pub(super) fn push(&mut self, value: Val) -> Result<(), Error> { child(&value)?; if self.len() == self.capacity() { - self.reserve(self.capacity().max(1).saturating_mul(2))?; + self.reserve(self.len().saturating_add(1))?; } self.body.push(value); Ok(()) @@ -155,32 +171,56 @@ impl Container> { impl Container { pub(super) fn insert(&mut self, key: Val, value: Val) -> Result<(), Error> { + self.update(key, |_| Ok(Some(value))) + } + + /// Transform one owned child without exposing a mutable entry. IndexMap's + /// entry lookup does not allocate; only vacant insertion can grow storage. + /// Admit that growth before insertion and reconcile it before returning. + pub(super) fn update>( + &mut self, + key: Val, + change: impl FnOnce(Val) -> Result, E>, + ) -> Result<(), E> { + use indexmap::map::Entry; child(&key)?; - child(&value)?; - if !self.body.contains_key(&key) && self.len() == self.capacity() { - // IndexMap chooses geometric capacities for its entry/index tables. - // Admit a conservative full replacement while the old body lives. - // Include IndexMap's minimum table allocation even at len == 0. + let may_grow = self.len() == self.capacity(); + let growth = if may_grow { + // Include IndexMap's minimum table and geometric replacement. let capacity = self.len().saturating_add(1).next_power_of_two().max(4); - let bytes = capacity + capacity .saturating_mul(2) - .saturating_mul(size_of::<(Val, Val)>() + 2 * size_of::()); - meter::check(bytes)?; - self.body.reserve(1); - self.body.resync(); + .saturating_mul(size_of::<(Val, Val)>() + 2 * size_of::()) + } else { + 0 + }; + match self.body.entry(key) { + Entry::Occupied(mut entry) => { + // Taking preserves string-buffer uniqueness in update folds. + let old = std::mem::take(entry.get_mut()); + if let Some(value) = change(old)? { + child(&value)?; + entry.insert(value); + } else { + entry.swap_remove(); + } + } + Entry::Vacant(entry) => { + if let Some(value) = change(Val::Null)? { + child(&value)?; + if may_grow { + meter::check(growth)?; + } + entry.insert(value); + if may_grow { + self.body.resync(); + } + } + } } - self.body.insert(key, value); Ok(()) } - pub(super) fn take(&mut self, key: &Val) -> Option { - self.body.get_mut(key).map(std::mem::take) - } - - pub(super) fn remove(&mut self, key: &Val) { - self.body.swap_remove(key); - } - pub(super) fn append(&mut self, values: &Self) -> Result<(), Error> { for (key, value) in values { self.insert(key.clone(), value.clone())?; @@ -223,14 +263,16 @@ pub(super) fn entries(object: &Container) -> Metered> { pub(super) fn merge(left: &mut Rc>, right: Rc>) -> Result<(), Error> { let left = Rc::make_mut(left); for (key, value) in super::jaq_json::rc_unwrap_or_clone(right) { - let value = match (left.take(&key), value) { - (Some(Val::Obj(mut left)), Val::Obj(right)) => { - merge(&mut left, right)?; - Val::Obj(left) - } - (_, value) => value, - }; - left.insert(key, value)?; + left.update(key, |old| { + let value = match (old, value) { + (Val::Obj(mut left), Val::Obj(right)) => { + merge(&mut left, right)?; + Val::Obj(left) + } + (_, value) => value, + }; + Ok::<_, Error>(Some(value)) + })?; } Ok(()) } diff --git a/crates/bashkit/src/builtins/jq/owned/tests.rs b/crates/bashkit/src/builtins/jq/owned/tests.rs index d4876c488..9feedc1b1 100644 --- a/crates/bashkit/src/builtins/jq/owned/tests.rs +++ b/crates/bashkit/src/builtins/jq/owned/tests.rs @@ -98,7 +98,7 @@ async fn synchronous_evaluation_observes_host_cancellation() { let start = std::time::Instant::now(); let result = bash.exec("jq -n 'until(false; .)'").await; cancel.join().unwrap(); - assert!(result.unwrap_err().to_string().contains("cancelled")); + assert!(matches!(result, Err(crate::Error::Cancelled))); assert!(start.elapsed() < std::time::Duration::from_secs(3)); // The host owns resetting the shared flag before starting another request. bash.cancellation_token() @@ -122,43 +122,174 @@ fn collection_charges_capacity_before_advancing_the_iterator() { } #[test] -fn lifecycle_traversals_poll_the_stop_check() { - use std::hash::{Hash, Hasher}; - - // Two separately built shared trees. Equality cannot use Rc identity to - // skip their descendants. Small enough to finish even without polling. - let tree = || { - let mut value = Val::Null; - for _ in 0..13 { - value = [value.clone(), value].into_iter().collect(); +fn nested_meter_restores_poll_progress() { + let outer_calls = Rc::new(std::cell::Cell::new(0)); + let calls = outer_calls.clone(); + let (_guard, _meter) = meter::install( + 4096, + Some(Box::new(move || { + calls.set(calls.get() + 1); + false + })), + ); + for _ in 0..meter::TICKS_PER_POLL - 1 { + meter::tick(); + } + { + let (_inner_guard, _inner_meter) = meter::install(4096, Some(Box::new(|| false))); + for _ in 0..meter::TICKS_PER_POLL + 1 { + meter::tick(); } - value - }; - let left = tree(); - let right = tree(); - for operation in ["equality", "ordering", "hash", "format"] { - let (_guard, _meter) = meter::install(1 << 20, Some(Box::new(|| true))); - let abort = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| match operation { - "equality" => { - std::hint::black_box(left == right); - } - "ordering" => { - std::hint::black_box(left.cmp(&right)); - } - "hash" => { - let mut hash = std::collections::hash_map::DefaultHasher::new(); - left.hash(&mut hash); - std::hint::black_box(hash.finish()); + } + assert_eq!(outer_calls.get(), 0); + meter::tick(); + assert_eq!(outer_calls.get(), 1); +} + +#[test] +fn array_growth_uses_the_remaining_budget_without_over_reserving() { + let (_guard, meter) = meter::install(6 * size_of::(), None); + let mut values = Container::>::default(); + for index in 0..6 { + values.set(index, Val::from(index)).unwrap(); + } + assert_eq!(values.len(), 6); + assert_eq!(meter::headroom(), 0); + assert!(!meter.tripped()); +} + +#[test] +fn a_single_element_can_use_the_exact_remaining_budget() { + let (_guard, meter) = meter::install(size_of::(), None); + let mut values = Container::>::default(); + values.push(Val::Null).unwrap(); + assert_eq!(values.len(), 1); + assert_eq!(meter::headroom(), 0); + assert!(!meter.tripped()); +} + +#[test] +fn replacing_a_full_object_does_not_reserve_more_storage() { + let (_guard, _meter) = meter::install(4096, None); + let mut object = Container::::default(); + object.insert(Val::utf8_str("0"), Val::Null).unwrap(); + for index in 1..object.capacity() { + object + .insert(Val::from(index.to_string()), Val::Null) + .unwrap(); + } + assert_eq!(object.len(), object.capacity()); + let available = meter::headroom(); + let key = object.keys().next().unwrap().clone(); + object.insert(key, Val::Bool(true)).unwrap(); + assert_eq!(meter::headroom(), available); +} + +#[test] +fn absent_object_updates_do_not_allocate_before_the_callback_result() { + let key = Val::utf8_str("key"); + let error = Error::str("callback failed"); + let (_guard, meter) = meter::install(0, None); + let mut object = Container::::default(); + object + .update(key.clone(), |_| Ok::<_, Error>(None)) + .unwrap(); + assert!(object.update(key, |_| Err(error)).is_err()); + assert_eq!(object.capacity(), 0); + assert!(object.is_empty()); + assert!(!meter.tripped()); +} + +fn decoded(value: Val) -> serde_json::Value { + serde_json::from_str(&value.to_string()).unwrap() +} + +proptest::proptest! { + #![proptest_config(proptest::test_runner::Config::with_cases(64))] + + #[test] + fn arrays_match_native_model(actions in proptest::collection::vec((0u8..5, 0usize..64, -1000isize..1000), 0..128)) { + let (_guard, _meter) = meter::install(4 * 1024 * 1024, None); + let initial = meter::headroom(); + let mut actual = Rc::new(Container::>::default()); + let mut model: Vec> = Vec::new(); + for (operation, index, value) in actions { + match operation { + 0 | 4 => { + let snapshot = (operation == 4).then(|| actual.clone()); + let before = serde_json::to_value(&model).unwrap(); + Rc::make_mut(&mut actual).set(index, Val::from(value)).unwrap(); + if let Some(snapshot) = snapshot { + proptest::prop_assert_eq!(decoded(Val::Arr(snapshot)), before); + } + model.resize(model.len().max(index + 1), None); + model[index] = Some(value); + } + 1 if !model.is_empty() => { + let index = index % model.len(); + Rc::make_mut(&mut actual).remove(index); + model.remove(index); + } + 2 if !model.is_empty() => { + let index = index % model.len(); + let old = Rc::make_mut(&mut actual).take(index); + proptest::prop_assert_eq!(decoded(old), serde_json::to_value(model[index].take()).unwrap()); + } + 3 => { + let skip = index % (model.len() + 1); + let take = (index % 4).min(model.len() - skip); + let replacement = array([Val::from(value)]); + Rc::make_mut(&mut actual).splice(skip, take, &replacement).unwrap(); + model.splice(skip..skip + take, [Some(value)]); + } + _ => {} } - _ => { - std::hint::black_box(left.to_string()); + proptest::prop_assert_eq!(decoded(Val::Arr(actual.clone())), serde_json::to_value(&model).unwrap()); + } + drop(actual); + proptest::prop_assert_eq!(meter::headroom(), initial); + } + + #[test] + fn objects_match_native_model(actions in proptest::collection::vec((0u8..5, 0usize..32, -1000isize..1000), 0..128)) { + let (_guard, _meter) = meter::install(4 * 1024 * 1024, None); + let initial = meter::headroom(); + let mut actual = Rc::new(Container::::default()); + let mut model = std::collections::BTreeMap::>::new(); + for (operation, index, value) in actions { + let key = index.to_string(); + match operation { + 0 | 3 => { + let snapshot = (operation == 3).then(|| actual.clone()); + let before = serde_json::to_value(&model).unwrap(); + Rc::make_mut(&mut actual).insert(Val::from(key.clone()), Val::from(value)).unwrap(); + if let Some(snapshot) = snapshot { + proptest::prop_assert_eq!(decoded(Val::Obj(snapshot)), before); + } + model.insert(key, Some(value)); + } + 1 => { + Rc::make_mut(&mut actual).update(Val::from(key.clone()), |_| Ok::<_, Error>(None)).unwrap(); + model.remove(&key); + } + 2 => { + let mut old = None; + Rc::make_mut(&mut actual).update(Val::from(key.clone()), |value| { + old = Some(value); + Ok::<_, Error>(Some(Val::Null)) + }).unwrap(); + let expected = model.insert(key, None).flatten(); + proptest::prop_assert_eq!(decoded(old.unwrap()), serde_json::to_value(expected).unwrap()); + } + _ => { + let Val::Obj(right) = object([(Val::from(key.clone()), Val::from(value))]).unwrap() else { unreachable!() }; + merge(&mut actual, right).unwrap(); + model.insert(key, Some(value)); + } } - })); - assert!( - abort - .is_err_and(|error| error.downcast_ref::() - == Some(&meter::Abort::Interrupted)), - "{operation} did not poll cancellation" - ); + proptest::prop_assert_eq!(decoded(Val::Obj(actual.clone())), serde_json::to_value(&model).unwrap()); + } + drop(actual); + proptest::prop_assert_eq!(meter::headroom(), initial); } } diff --git a/crates/bashkit/src/builtins/jq/tests.rs b/crates/bashkit/src/builtins/jq/tests.rs index bfc11cfbe..30c923fde 100644 --- a/crates/bashkit/src/builtins/jq/tests.rs +++ b/crates/bashkit/src/builtins/jq/tests.rs @@ -1716,7 +1716,12 @@ mod differential { fn run_real_jq(args: &[&str], input: &str) -> Option<(String, i32)> { use std::io::Write; use std::process::{Command, Stdio}; - let mut child = Command::new("jq") + let mut command = Command::new("jq"); + // Bashkit streams have Unix newlines on every host. Native Windows jq + // otherwise translates stdout to CRLF before the oracle can compare it. + #[cfg(windows)] + command.arg("--binary"); + let mut child = command .args(args) .stdin(Stdio::piped()) .stdout(Stdio::piped()) From df160c51a762960b2f8c3e74fb14bff622001f96 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 15:45:55 -0600 Subject: [PATCH 04/12] test(jq): integrate owned runtime across native validation and embeddings --- .github/workflows/ci.yml | 178 +++++++++++------- .github/workflows/coverage.yml | 9 +- .github/workflows/fuzz.yml | 8 +- .github/workflows/js.yml | 9 +- .github/workflows/nightly.yml | 19 ++ .github/workflows/python.yml | 13 +- README.md | 1 + crates/bashkit-bench/Cargo.toml | 4 + crates/bashkit-capi/Cargo.toml | 3 + crates/bashkit-eval/Cargo.toml | 4 + crates/bashkit-js/Cargo.toml | 3 + crates/bashkit-python/Cargo.toml | 3 + crates/bashkit-scripted-tool/Cargo.toml | 3 + crates/bashkit-wasm/Cargo.toml | 3 + crates/bashkit/docs/jq.md | 16 +- crates/bashkit/docs/yq.md | 2 + crates/bashkit/fuzz/Cargo.toml | 7 + .../fuzz/fuzz_targets/jq_lifecycle_fuzz.rs | 83 ++++++++ justfile | 26 +++ scripts/bench-jq.py | 119 ++++++++++++ scripts/fuzz-smoke.py | 12 +- scripts/install-jq-ci.sh | 26 ++- scripts/tests/test_experimental_jq_ci.py | 80 ++++++++ 23 files changed, 537 insertions(+), 94 deletions(-) create mode 100644 crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs create mode 100644 scripts/bench-jq.py create mode 100644 scripts/tests/test_experimental_jq_ci.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61f0f0cd1..1d6d5777e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,6 @@ +# The independent native jq matrix sweeps both flags. Instrumented package +# rows also enable owned jq so binding/browser artifacts execute that backend +# without doubling every language-version/architecture packaging matrix. name: CI on: @@ -209,7 +212,7 @@ jobs: run: sudo ./scripts/install-binaryen.sh - name: Build web bundle - run: BASHKIT_WASM_FEATURES="terminal,${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" bash crates/bashkit-wasm/scripts/build.sh release + run: BASHKIT_WASM_FEATURES="terminal,${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" bash crates/bashkit-wasm/scripts/build.sh release - name: Integration tests (headless Node) run: node --test "crates/bashkit-wasm/__test__/*.test.mjs" @@ -223,7 +226,7 @@ jobs: node crates/bashkit-wasm/scripts/test-streaming-browser.mjs - name: Build optional runtime bundle - run: BASHKIT_WASM_VARIANT=runtimes BASHKIT_WASM_FEATURES="terminal,python,typescript,${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" bash crates/bashkit-wasm/scripts/build.sh release + run: BASHKIT_WASM_VARIANT=runtimes BASHKIT_WASM_FEATURES="terminal,python,typescript,${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" bash crates/bashkit-wasm/scripts/build.sh release - name: Embedded runtime callback tests run: BASHKIT_WASM_VARIANT=runtimes node --test crates/bashkit-wasm/__test__/runtime-functions.test.mjs @@ -299,6 +302,40 @@ jobs: - name: Supply chain audit (cargo-vet) run: cargo vet --locked + # Independent axes prove that owning jq does not rely on the shell compiler. + jq-native: + name: Native jq (${{ matrix.os }}, owned=${{ matrix.experimental_jq }}, plan=${{ matrix.execution_plan }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, macos-latest, windows-latest] + experimental_jq: [false, true] + execution_plan: [false, true] + defaults: + run: + shell: bash + env: + JQ_FEATURES: jq${{ matrix.experimental_jq && ',experimental_jq' || '' }}${{ matrix.execution_plan && ',experimental_execution_plan' || '' }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@9522411a9bce8484da960823fc2f46e52f981f71 # 1.100.0 + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 + with: + shared-key: jq-native-${{ matrix.os }}-${{ matrix.experimental_jq }}-${{ matrix.execution_plan }} + - name: Install pinned native jq oracle + run: scripts/install-jq-ci.sh "$JQ_VERSION" + - name: Run jq and yq compatibility, lifecycle and resource suites + run: cargo test --locked -p bashkit --no-default-features --features "$JQ_FEATURES" --lib --test integration -- jq yq + - name: Run serialized security fault injection + run: cargo test --locked -p bashkit --features "$JQ_FEATURES,failpoints" --test security_failpoint_tests -- --test-threads=1 + - name: Smoke the native CLI feature forwarding + run: | + cargo run --locked -p bashkit-cli --no-default-features --features="${{ matrix.experimental_jq && 'experimental_jq,' || '' }}${{ matrix.execution_plan && 'experimental_execution_plan' || '' }}" -- -c 'result=$(jq -nc "[range(4)] | map(. * 2)"); test "$result" = "[0,2,4,6]"' + test: name: Test (${{ matrix.execution_plan && 'execution-plan' || 'interpreter' }}) # Pinned, not `ubuntu-latest`: this job's `*_match_gnu` differential tests @@ -363,21 +400,15 @@ jobs: - name: Install pinned jq for differential tests run: scripts/install-jq-ci.sh "$JQ_VERSION" - # jq/yq share the experimental owned value boundary. Keep the default - # workspace run below on the established backend; exercise both here. - - name: Test experimental jq containers - if: ${{ !matrix.execution_plan }} - run: cargo test -p bashkit --no-default-features --features experimental_jq --lib --test integration -- jq yq - # Examples have a dedicated job below; skipping them here avoids # duplicated example links that can exhaust runner disk on main. - name: Run tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --workspace --lib --bins --tests --features http_client,ssh,sqlite + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --workspace --lib --bins --tests --features http_client,ssh,sqlite # The registry's Python/TypeScript surfaces sit behind the crate's own # features, which no workspace member turns on together. - name: Run scripted tool tests (shell, Python, TypeScript surfaces) - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit-scripted-tool --features python,typescript,jq + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit-scripted-tool --features python,typescript,jq # All three differential gates (bash, sed, grep), not just bash: each is # the only thing checking that its spec expectations still describe the @@ -389,19 +420,19 @@ jobs: # workflow file out of service. - name: Run strict host-tool parity gates (bash, sed, grep) run: | - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration --features http_client,ssh -- spec_tests:: --ignored + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration --features http_client,ssh -- spec_tests:: --ignored - name: Run competitor regression corpus - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration --features http_client,jq -- competitor_regression_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration --features http_client,jq -- competitor_regression_tests - name: Run doc tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --workspace --doc --features http_client,ssh,sqlite + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --workspace --doc --features http_client,ssh,sqlite # CPython (wasm) python3: unit, integration, capability (diffed against # the runner's python3), security and load tests. Feature-gated, so the # main test step above does not build it into bashkit. - name: Run CPython tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features cpython,http_client --lib --test integration -- cpython + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features cpython,http_client --lib --test integration -- cpython # bashkit's own requests/httpx (guest modules) against the upstream # packages: same scenarios, same output. @@ -413,44 +444,44 @@ jobs: # Same suites on the opt-in native-code build (`cpython-native`). - name: Run CPython tests (native code) - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features cpython-native,http_client --lib --test integration -- cpython + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features cpython-native,http_client --lib --test integration -- cpython - name: Run realfs tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --features realfs -p bashkit --test realfs_tests -p bashkit-cli + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --features realfs -p bashkit --test realfs_tests -p bashkit-cli # The third-party adoption and host-mount suites are `cfg(realfs)`, so # the main "Run tests" step (no realfs) compiles them out entirely. - name: Run realfs integration tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration --features realfs -- host_mounts_tests thirdparty_adoption_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration --features realfs -- host_mounts_tests thirdparty_adoption_tests # In-process terminal + vi builtin are `cfg(terminal)` (off by default), # so the main "Run tests" step compiles them out entirely. - name: Run terminal tests run: | - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features terminal,git --lib -- terminal:: builtins::vi:: builtins::pager:: builtins::nano:: - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features terminal --test integration -- terminal_tests l_term_ - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features terminal --doc terminal + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features terminal,git --lib -- terminal:: builtins::vi:: builtins::pager:: builtins::nano:: + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features terminal --test integration -- terminal_tests l_term_ + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features terminal --doc terminal # markkit/fetchkit builtins are `cfg(markkit|fetchkit)` (off by default), # so the main "Run tests" step compiles them out entirely. - name: Run markkit/fetchkit builtin tests run: | - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features markkit,fetchkit --lib -- builtins::markkit:: builtins::fetchkit:: - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features markkit,fetchkit --test integration -- markkit_builtin_tests fetchkit_builtin_tests - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features markkit --test integration -- markkit_builtin_tests - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features markkit,fetchkit --doc -- markkit_fetchkit_guide + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features markkit,fetchkit --lib -- builtins::markkit:: builtins::fetchkit:: + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features markkit,fetchkit --test integration -- markkit_builtin_tests fetchkit_builtin_tests + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features markkit --test integration -- markkit_builtin_tests + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features markkit,fetchkit --doc -- markkit_fetchkit_guide # jq must keep working when another crate unifies serde_json's # arbitrary_precision on (issue #2964): non-integers then arrive via # visit_map with the private token instead of visit_f64. - name: Run jq tests with arbitrary_precision unified on - run: "cargo test --features=\"${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}\" -p bashkit --lib --features jq,serde_json/arbitrary_precision -- builtins::jq::" + run: "cargo test --features=\"${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}\" -p bashkit --lib --features jq,serde_json/arbitrary_precision -- builtins::jq::" - name: Run failpoint unit and security tests (single-threaded) - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --features failpoints --lib --test security_failpoint_tests -- --test-threads=1 + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --features failpoints --lib --test security_failpoint_tests -- --test-threads=1 - name: Run property-based security tests (proptest) - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --test proptest_security -- --test-threads=1 + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --test proptest_security -- --test-threads=1 env: PROPTEST_CASES: 50 @@ -501,7 +532,7 @@ jobs: run: cargo test --locked -p bashkit-cpython-wasm --lib - name: Execute CPython through the shell - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --locked -p bashkit --features cpython --test integration -- cpython_integration_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --locked -p bashkit --features cpython --test integration -- cpython_integration_tests windows-containment: # THREAT[TM-ESC-033]: Windows path parsing has drive, UNC, device, and @@ -525,19 +556,19 @@ jobs: shared-key: windows-containment - name: Test VFS path normalization - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --lib --features realfs windows_containment + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --lib --features realfs windows_containment - name: Test RealFS and overlay containment - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test realfs_tests --features realfs windows_containment + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test realfs_tests --features realfs windows_containment - name: Test touch mtime on Windows (issue #2388) - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test realfs_tests --features realfs realfs_touch + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test realfs_tests --features realfs realfs_touch # The C ABI mount-root guard is Windows-conditional, so the Linux # workspace test run compiles it out. Nothing else runs bashkit-capi's # tests on Windows, which left them never executing anywhere. - name: Test C ABI mount-root validation and runtime callbacks - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit-capi --lib --test runtime_functions + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit-capi --lib --test runtime_functions # The adoption shape this covers — bashkit as an agent's shell, with commands # bridged to host processes — exists to work on Windows without a real bash. @@ -564,18 +595,18 @@ jobs: shared-key: windows-adoption - name: Run third-party adoption tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration --features realfs -- thirdparty_adoption_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration --features realfs -- thirdparty_adoption_tests - name: Run host mount mapping tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration --features realfs -- host_mounts_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration --features realfs -- host_mounts_tests # The VFS is `/`-separated on every host; host-separator joins only show # up here (#2425, #2933). Reuses the realfs build from the steps above. - name: Run VFS separator and device path tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration --features realfs -- windows_containment dev_fd_path_tests dev_null_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration --features realfs -- windows_containment dev_fd_path_tests dev_null_tests - name: Run command resolver tests - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit --test integration -- command_resolver_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit --test integration -- command_resolver_tests examples: name: Examples (${{ matrix.execution_plan && 'execution-plan' || 'interpreter' }}) @@ -591,7 +622,7 @@ jobs: matrix: execution_plan: [false, true] env: - EXECUTION_PLAN_FEATURE: ${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }} + EXECUTION_PLAN_FEATURE: ${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -603,51 +634,51 @@ jobs: - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 - name: Build examples - run: cargo build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --examples --features "git,http_client,ssh,sqlite" + run: cargo build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --examples --features "git,http_client,ssh,sqlite" - name: Run C API examples env: - BASHKIT_CAPI_FEATURES: ${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }} + BASHKIT_CAPI_FEATURES: ${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }} run: ./scripts/run-c-api-examples.sh - name: Run examples run: | - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example basic - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example custom_fs - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example clap_builtin - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example clap_builtin_subcommands - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit-scripted-tool --example scripted_tool_clap_builtin - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example resource_limits - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example text_processing - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example live_mounts - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example git_workflow --features git - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example python_external_functions --features python - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example cpython_scripts --features cpython - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example typescript_external_functions --features typescript - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example realfs_readonly --features realfs - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example realfs_readwrite --features realfs - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example sqlite_basic --features sqlite - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example sqlite_workflow --features sqlite - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example markkit_fetchkit --features markkit,fetchkit - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example terminal_vi --features terminal - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example terminal_record --features terminal + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example basic + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example custom_fs + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example clap_builtin + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example clap_builtin_subcommands + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit-scripted-tool --example scripted_tool_clap_builtin + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example resource_limits + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example text_processing + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example live_mounts + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example git_workflow --features git + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example python_external_functions --features python + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example cpython_scripts --features cpython + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example typescript_external_functions --features typescript + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example realfs_readonly --features realfs + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example realfs_readwrite --features realfs + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example sqlite_basic --features sqlite + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example sqlite_workflow --features sqlite + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example markkit_fetchkit --features markkit,fetchkit + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example terminal_vi --features terminal + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example terminal_record --features terminal # SSH tests - name: Run ssh builtin tests (mock handler) - run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --features ssh -p bashkit --test ssh_builtin_tests + run: cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --features ssh -p bashkit --test ssh_builtin_tests - name: Run ssh supabase.sh example and tests run: | if nc -z -w 5 supabase.sh 22 2>/dev/null; then - cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --example ssh_supabase --features ssh - cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --features ssh -p bashkit --test ssh_supabase_tests + cargo run --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --example ssh_supabase --features ssh + cargo test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --features ssh -p bashkit --test ssh_supabase_tests else echo "::warning::supabase.sh:22 unreachable from this runner — skipping live SSH tests" fi - name: Run realfs bash example run: | - cargo build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -p bashkit-cli --features realfs + cargo build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -p bashkit-cli --features realfs bash examples/realfs_mount.sh - name: Run ticket CLI example @@ -746,12 +777,13 @@ jobs: run: bash examples/harness-openai-joke.sh fuzz-check: - name: Fuzz build and smoke (${{ matrix.execution_plan && 'execution-plan' || 'interpreter' }}) + name: Fuzz build and smoke (plan=${{ matrix.execution_plan }}, owned-jq=${{ matrix.experimental_jq }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: execution_plan: [false, true] + experimental_jq: [false, true] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -785,10 +817,11 @@ jobs: - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: workspaces: crates/bashkit/fuzz -> target - shared-key: fuzz-smoke-${{ matrix.execution_plan }} + shared-key: fuzz-smoke-${{ matrix.execution_plan }}-${{ matrix.experimental_jq }} cache-on-failure: true - name: Verify fuzz targets compile + if: ${{ !matrix.experimental_jq }} working-directory: crates/bashkit run: | cargo +nightly-2026-10-30 fuzz build --codegen-units 16 --features="${{ matrix.execution_plan && 'experimental_execution_plan' || '' }}" @@ -798,21 +831,29 @@ jobs: cargo +nightly-2026-10-30 fuzz build --codegen-units 16 --features="python,cpython${{ matrix.execution_plan && ',experimental_execution_plan' || '' }}" python_diff_fuzz cargo +nightly-2026-10-30 fuzz build --codegen-units 16 --features="typescript${{ matrix.execution_plan && ',experimental_execution_plan' || '' }}" ts_fuzz - - name: Smoke every fuzz target (manifest-discovered, bounded) - run: python3 scripts/fuzz-smoke.py ${{ matrix.execution_plan && '--execution-plan' || '' }} + - name: Verify owned jq fuzz targets compile + if: matrix.experimental_jq + working-directory: crates/bashkit + run: | + for target in jq_fuzz yq_fuzz jq_lifecycle_fuzz; do + cargo +nightly-2026-10-30 fuzz build --codegen-units 16 --features="experimental_jq${{ matrix.execution_plan && ',experimental_execution_plan' || '' }}" "$target" + done + + - name: Smoke every selected fuzz target (manifest-discovered, bounded) + run: python3 scripts/fuzz-smoke.py ${{ matrix.execution_plan && '--execution-plan' || '' }} ${{ matrix.experimental_jq && '--experimental-jq' || '' }} - name: Upload fuzz failures if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: - name: fuzz-smoke-failures-${{ matrix.execution_plan }} + name: fuzz-smoke-failures-${{ matrix.execution_plan }}-${{ matrix.experimental_jq }} path: crates/bashkit/fuzz/artifacts # Gate job for branch protection — name must stay "Check" check: name: Check if: always() - needs: [msrv, lint, audit, test, cpython-platforms, windows-containment, test-windows, examples, fuzz-check, wasm, wasm-component, wasm-web] + needs: [msrv, lint, audit, test, jq-native, cpython-platforms, windows-containment, test-windows, examples, fuzz-check, wasm, wasm-component, wasm-web] runs-on: ubuntu-latest steps: - name: Verify all jobs passed @@ -821,6 +862,7 @@ jobs: [[ "${{ needs.lint.result }}" != "success" ]] || \ [[ "${{ needs.audit.result }}" != "success" ]] || \ [[ "${{ needs.test.result }}" != "success" ]] || \ + [[ "${{ needs.jq-native.result }}" != "success" ]] || \ [[ "${{ needs.cpython-platforms.result }}" != "success" ]] || \ [[ "${{ needs.windows-containment.result }}" != "success" ]] || \ [[ "${{ needs.test-windows.result }}" != "success" ]] || \ diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 573a4b718..7c69d52dc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -24,7 +24,7 @@ env: jobs: coverage: - name: Rust coverage (plan=${{ matrix.execution_plan }}) + name: Rust coverage (plan=${{ matrix.execution_plan }}, owned-jq=${{ matrix.experimental_jq }}) # Pinned for the GNU coreutils oracle, like ci.yml's `test` job; see the # note there. runs-on: ubuntu-24.04 @@ -33,6 +33,7 @@ jobs: fail-fast: false matrix: execution_plan: [false, true] + experimental_jq: [false, true] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -64,13 +65,13 @@ jobs: # (past --timeout). Its tests still run in the main CI test job. - name: Generate coverage report run: | - cargo tarpaulin --features="http_client${{ matrix.execution_plan && ',bashkit/experimental_execution_plan' || '' }}" \ + cargo tarpaulin --features="http_client,jq${{ matrix.experimental_jq && ',bashkit/experimental_jq' || '' }}${{ matrix.execution_plan && ',bashkit/experimental_execution_plan' || '' }}" \ --workspace \ --exclude bashkit-python \ --exclude bashkit-eval \ --out xml \ --out html \ - --output-dir coverage/${{ matrix.execution_plan }} \ + --output-dir coverage/${{ matrix.execution_plan }}-${{ matrix.experimental_jq }} \ --exclude-files "crates/bashkit-bench/*" \ --exclude-files "crates/bashkit-cli/*" \ --exclude-files "crates/bashkit-python/*" \ @@ -81,7 +82,7 @@ jobs: - name: Upload coverage artifacts uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: - name: rust-${{ matrix.execution_plan }}-coverage-report + name: rust-${{ matrix.execution_plan }}-${{ matrix.experimental_jq }}-coverage-report path: coverage/ retention-days: 30 diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 90e9da9ce..954ccf41d 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -32,7 +32,7 @@ jobs: run: echo "matrix=$(python3 scripts/fuzz-smoke.py --matrix)" >> "$GITHUB_OUTPUT" fuzz: - name: Fuzz (${{ matrix.target }}, plan=${{ matrix.execution_plan }}) + name: Fuzz (${{ matrix.target }}, plan=${{ matrix.execution_plan }}, owned-jq=${{ matrix.experimental_jq }}) needs: targets runs-on: ubuntu-latest strategy: @@ -76,9 +76,9 @@ jobs: uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5 with: path: crates/bashkit/fuzz/corpus - key: fuzz-corpus-${{ matrix.target }}-${{ matrix.execution_plan }}-${{ github.sha }} + key: fuzz-corpus-${{ matrix.target }}-${{ matrix.execution_plan }}-${{ matrix.experimental_jq }}-${{ github.sha }} restore-keys: | - fuzz-corpus-${{ matrix.target }}-${{ matrix.execution_plan }}- + fuzz-corpus-${{ matrix.target }}-${{ matrix.execution_plan }}-${{ matrix.experimental_jq }}- - name: Run fuzzer - ${{ matrix.target }} working-directory: crates/bashkit @@ -107,7 +107,7 @@ jobs: if: failure() uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: - name: fuzz-crashes-${{ matrix.target }}-${{ matrix.execution_plan }} + name: fuzz-crashes-${{ matrix.target }}-${{ matrix.execution_plan }}-${{ matrix.experimental_jq }} path: | crates/bashkit/fuzz/artifacts/${{ matrix.target }} retention-days: 30 diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 6b612ae36..a825c4369 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -1,3 +1,6 @@ +# The independent native jq matrix sweeps both flags. Instrumented package +# rows also enable owned jq so binding/browser artifacts execute that backend +# without doubling every language-version/architecture packaging matrix. # JavaScript/TypeScript CI — builds NAPI-RS bindings and runs tests # Triggered on PRs and pushes to main when JS-related files change. @@ -195,7 +198,7 @@ jobs: - name: Build native binding run: | - pnpm exec napi build --platform --release --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" + pnpm exec napi build --platform --release --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" pnpm run build:cjs pnpm run build:ts working-directory: crates/bashkit-js @@ -347,7 +350,7 @@ jobs: working-directory: crates/bashkit-js - if: ${{ !matrix.target }} run: | - pnpm exec napi build --platform --release --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" + pnpm exec napi build --platform --release --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" pnpm run build:cjs pnpm run build:ts working-directory: crates/bashkit-js @@ -370,7 +373,7 @@ jobs: # resumes rather than rebuilds. Only the toolchain crash is retried: # a genuine compile error fails again and still fails the job. for attempt in 1 2 3; do - if pnpm exec napi build --platform --release --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --target ${{ matrix.target }}; then + if pnpm exec napi build --platform --release --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --target ${{ matrix.target }}; then break fi if [ "$attempt" = 3 ]; then diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ea2b91c5c..0fe07eee9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -63,6 +63,16 @@ jobs: env: MIRIFLAGS: -Zmiri-disable-isolation + - name: Miri owned jq storage and iterator lifetimes + run: | + cargo +nightly-2026-10-30 miri test -p bashkit --no-default-features --features experimental_jq --lib -- \ + --test-threads=1 refused_attachment_leaves_the_container_valid \ + failed_cow_does_not_copy_or_change_the_shared_body failed_object_growth_does_not_reserve_storage \ + removal_invalidates_depth_and_drop_refunds_storage owning_iterator_keeps_storage_charged_until_drop \ + collection_charges_capacity_before_advancing_the_iterator nested_meter_restores_poll_progress + env: + MIRIFLAGS: -Zmiri-disable-isolation + # CI audits lockfiles on push and PR only, so main goes unscanned for as long # as nobody pushes — and an advisory is published against code that has not # changed. This job re-runs the same scan daily against a fresh copy of the @@ -224,6 +234,15 @@ jobs: cargo +nightly-2026-10-30 test --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -Z build-std --target x86_64-unknown-linux-gnu --lib --tests \ -- --test-threads=1 + - name: Run owned jq lifecycle and compatibility tests with AddressSanitizer + env: + RUSTFLAGS: "-Z sanitizer=address" + ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=0" + run: | + cargo +nightly-2026-10-30 test --features="experimental_jq${{ matrix.execution_plan && ',experimental_execution_plan' || '' }}" \ + -Z build-std --target x86_64-unknown-linux-gnu -p bashkit --no-default-features --lib --test integration -- \ + --test-threads=1 jq yq + # The default-feature run above leaves out embedded python3. The Monty # forks (crates/bashkit-monty*) are our code now, with unsafe in the # metered allocator and VM, so their tests get their own ASan pass. diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 58e8e291e..5ed659b1b 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,3 +1,6 @@ +# The independent native jq matrix sweeps both flags. Instrumented package +# rows also enable owned jq so binding/browser artifacts execute that backend +# without doubling every language-version/architecture packaging matrix. # CI for bashkit Python package # Builds the native extension via maturin and runs pytest on each PR. # Complements publish-python.yml (release-only) with per-PR validation. @@ -122,7 +125,7 @@ jobs: # abi3-py39), so it must be built against each interpreter. - name: Build random filesystem fixture run: | - python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --release --out /tmp/bashkit-random-fs \ + python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --release --out /tmp/bashkit-random-fs \ -m crates/bashkit-python/test-fixtures/random-fs/Cargo.toml \ -i python${{ matrix.python-version }} pip install bashkit-random-fs --no-index --find-links /tmp/bashkit-random-fs --force-reinstall @@ -154,7 +157,7 @@ jobs: - name: Build and install native wheel run: | python -m pip install "maturin${{ env.MATURIN_VERSION }}" - python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" -m crates/bashkit-python/Cargo.toml --out dist + python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" -m crates/bashkit-python/Cargo.toml --out dist python -m pip install bashkit --no-index --find-links dist python -m pip install pytest pytest-asyncio pytest-timeout langchain-core deepagents fastapi httpx - name: Install uvloop on Unix @@ -198,7 +201,7 @@ jobs: - name: Build wheel working-directory: crates/bashkit-python - run: python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --release --out dist -i python3.12 + run: python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --release --out dist -i python3.12 - name: Install local wheel run: | @@ -207,7 +210,7 @@ jobs: - name: Build random filesystem fixture run: | - python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --release --out /tmp/bashkit-random-fs \ + python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --release --out /tmp/bashkit-random-fs \ -m crates/bashkit-python/test-fixtures/random-fs/Cargo.toml \ -i python3.12 pip install bashkit-random-fs --no-index --find-links /tmp/bashkit-random-fs --force-reinstall @@ -251,7 +254,7 @@ jobs: - name: Build wheel working-directory: crates/bashkit-python - run: python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan' || '' }}" --release --out dist + run: python -m maturin build --features="${{ matrix.execution_plan && 'bashkit/experimental_execution_plan,bashkit/experimental_jq' || '' }}" --release --out dist - name: Verify wheel metadata run: | diff --git a/README.md b/README.md index 696699370..a5f7b2ee6 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Awesomely fast virtual sandbox with bash and file system. Written in Rust. - **Experimental: Python support** - Embedded Python interpreter via [Monty](https://github.com/pydantic/monty) (`python` feature), or real CPython 3.14 in a WebAssembly sandbox (`cpython` feature) - **Experimental: TypeScript support** - Embedded TypeScript interpreter via [ZapCode](https://github.com/TheUncharted/zapcode) (`typescript` feature) - **Experimental: script execution plans** - Opt-in compilation of scalar arithmetic and control flow, with interpreter fallback (`experimental_execution_plan` feature; [details](crates/bashkit/docs/compatibility.md#experimental-execution-plans)) +- **Experimental: owned jq containers** - Checked value/resource storage shared by jq and yq (`experimental_jq`, off by default; [details](crates/bashkit/docs/jq.md#experimental-owned-containers)) - **Experimental: SQLite support** - Embedded SQLite-compatible engine via [Turso](https://github.com/tursodatabase/turso) (`sqlite` feature) ## Install diff --git a/crates/bashkit-bench/Cargo.toml b/crates/bashkit-bench/Cargo.toml index c9cf3fdd2..f1aaf3704 100644 --- a/crates/bashkit-bench/Cargo.toml +++ b/crates/bashkit-bench/Cargo.toml @@ -26,3 +26,7 @@ tempfile.workspace = true # Terminal output colored = "3" tabled = "0.22" + +[features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] diff --git a/crates/bashkit-capi/Cargo.toml b/crates/bashkit-capi/Cargo.toml index 30ca7e291..f53fa96dd 100644 --- a/crates/bashkit-capi/Cargo.toml +++ b/crates/bashkit-capi/Cargo.toml @@ -23,5 +23,8 @@ serde_json = { workspace = true } tokio = { workspace = true } [features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] + # Opt-in script compiler; preserves ordinary Bash syntax and AST fallback. experimental_execution_plan = ["bashkit/experimental_execution_plan"] diff --git a/crates/bashkit-eval/Cargo.toml b/crates/bashkit-eval/Cargo.toml index 72362121b..96add3665 100644 --- a/crates/bashkit-eval/Cargo.toml +++ b/crates/bashkit-eval/Cargo.toml @@ -45,3 +45,7 @@ rustls = { workspace = true, features = ["ring"] } regex.workspace = true async-trait.workspace = true chrono.workspace = true + +[features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] diff --git a/crates/bashkit-js/Cargo.toml b/crates/bashkit-js/Cargo.toml index 58f1e689b..7d2bd0ac4 100644 --- a/crates/bashkit-js/Cargo.toml +++ b/crates/bashkit-js/Cargo.toml @@ -26,5 +26,8 @@ tokio = { version = "1", features = ["sync", "macros", "io-util", "rt", "time"] napi-build = { workspace = true } [features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] + # Opt-in script compiler; preserves ordinary Bash syntax and AST fallback. experimental_execution_plan = ["bashkit/experimental_execution_plan"] diff --git a/crates/bashkit-python/Cargo.toml b/crates/bashkit-python/Cargo.toml index b010478fd..7f930b354 100644 --- a/crates/bashkit-python/Cargo.toml +++ b/crates/bashkit-python/Cargo.toml @@ -55,5 +55,8 @@ bashkit-scripted-tool = { path = "../bashkit-scripted-tool", features = ["python tokio = { workspace = true } [features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] + # Opt-in script compiler; preserves ordinary Bash syntax and AST fallback. experimental_execution_plan = ["bashkit/experimental_execution_plan"] diff --git a/crates/bashkit-scripted-tool/Cargo.toml b/crates/bashkit-scripted-tool/Cargo.toml index a87b5dfc3..bfed18405 100644 --- a/crates/bashkit-scripted-tool/Cargo.toml +++ b/crates/bashkit-scripted-tool/Cargo.toml @@ -19,6 +19,9 @@ categories.workspace = true readme = "README.md" [features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] + # Opt-in script compiler; preserves ordinary Bash syntax and AST fallback. experimental_execution_plan = ["bashkit/experimental_execution_plan"] default = [] diff --git a/crates/bashkit-wasm/Cargo.toml b/crates/bashkit-wasm/Cargo.toml index 3bbf4888f..4534fa78d 100644 --- a/crates/bashkit-wasm/Cargo.toml +++ b/crates/bashkit-wasm/Cargo.toml @@ -28,6 +28,9 @@ repository.workspace = true publish = false [features] +# Opt-in checked jq containers; keep production defaults unchanged. +experimental_jq = ["bashkit/experimental_jq"] + # Opt-in script compiler; preserves ordinary Bash syntax and AST fallback. experimental_execution_plan = ["bashkit/experimental_execution_plan"] # Interactive `Terminal` class (keystrokes in, escape-sequence bytes out) for diff --git a/crates/bashkit/docs/jq.md b/crates/bashkit/docs/jq.md index b2a90b4b4..c70003cb8 100644 --- a/crates/bashkit/docs/jq.md +++ b/crates/bashkit/docs/jq.md @@ -11,7 +11,8 @@ bashkit) can avoid surprises. Build with `--features experimental_jq` to opt into Bashkit's owned jq container/resource boundary. This Cargo feature enables `jq`; it is disabled -by default and also available on `bashkit-cli`. It applies to both `jq` and +by default and forwarded by the CLI, C API, Python, JavaScript, browser, +scripted-tool, benchmark and evaluation crates. It applies to both `jq` and `yq`, which share the value runtime. The experiment retains jaq's parser, evaluator, standard library and Bashkit's @@ -24,8 +25,17 @@ earlier than the existing implementation. Performance improvement is not assumed. Untrusted filters still require unwinding builds or process isolation, as described below. Disable the feature to return to the existing implementation. -Comparison, hashing, containment and formatting also poll the execution stop -check while traversing values, including shared generated trees. +Both backends poll the execution stop check during comparison, hashing, +containment, byte conversion and formatting, including shared generated trees. +That safety fix also applies when the experimental feature is disabled. + +Native Linux, macOS and Windows CI runs both backends with both shell execution +modes against pinned jq 1.8.1. `just test-jq` runs the same local conformance +matrix, `just fuzz-jq` runs bounded fuzz smoke coverage, and `just bench-jq` +saves alternating benchmark comparisons and their raw estimates. The feature +also has property tests, sanitizer and Miri coverage. Package/browser test +artifacts exercise it in their instrumented configuration; release defaults +remain unchanged. ## Reported version diff --git a/crates/bashkit/docs/yq.md b/crates/bashkit/docs/yq.md index 8c113a622..2bb86880a 100644 --- a/crates/bashkit/docs/yq.md +++ b/crates/bashkit/docs/yq.md @@ -6,6 +6,8 @@ commonly use with mikefarah/yq. It parses YAML or JSON, evaluates the existing not maintain a second YAML-specific query language. Enable the Cargo `jq` feature to register both `jq` and `yq`. +The opt-in `experimental_jq` feature selects checked container storage for +both commands; see the [jq guide](crate::jq_guide) for its limits and validation. ## Examples diff --git a/crates/bashkit/fuzz/Cargo.toml b/crates/bashkit/fuzz/Cargo.toml index e0de57e15..20037f293 100644 --- a/crates/bashkit/fuzz/Cargo.toml +++ b/crates/bashkit/fuzz/Cargo.toml @@ -106,6 +106,13 @@ test = false doc = false bench = false +[[bin]] +name = "jq_lifecycle_fuzz" +path = "fuzz_targets/jq_lifecycle_fuzz.rs" +test = false +doc = false +bench = false + [[bin]] name = "awk_fuzz" path = "fuzz_targets/awk_fuzz.rs" diff --git a/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs b/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs new file mode 100644 index 000000000..c323f9645 --- /dev/null +++ b/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs @@ -0,0 +1,83 @@ +//! Structured native jq lifecycle/resource fuzzing, independently of its parser +//! grammar. Runs with both storage backends and both shell execution modes. +//! `cargo +nightly fuzz run jq_lifecycle_fuzz --features experimental_jq` + +#![no_main] + +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + if data.len() > 512 { + return; + } + let byte = |index| usize::from(data.get(index).copied().unwrap_or_default()); + let count = 1 + byte(1) * 8; + let depth = [0, 1, 98, 99, 100, 101, 200, 100_000][byte(2) % 8]; + let shared_depth = 1 + byte(2) % 32; + let filter = match byte(0) % 12 { + 0 => format!( + "[range({count})] | .[{}] = [1] | .[1:3] = [7,8] | .[0] |= empty | length", + count + byte(3) + ), + 1 => format!( + "reduce range({count}) as $i ({{}}; .[$i|tostring] = [$i]) | .[] |= (. + [3]) | length" + ), + 2 => { + format!("[range({count})] as $base | [$base, ($base | .[0] = 7), $base] | map(length)") + } + 3 => format!( + "(reduce range({count}) as $i ({{}}; .[$i|tostring] = {{a:$i}})) as $base | [$base, ($base * {{\"0\":{{b:3}}}}), $base] | map(length)" + ), + 4 => format!( + "reduce range({depth}) as $i (null; [.]) | {}", + ["empty", "length", "tojson", ". + 1"][byte(3) % 4] + ), + 5 => format!("try (reduce range({depth}) as $i (null; {{a:.}})) catch 0"), + 6 => format!("(\"[\" * {depth} + \"0\" + \"]\" * {depth}) | fromjson | length"), + 7 => format!("[range({count}) | . % 17] | sort | unique | . - [1,2,3] | length"), + 8 => { + let depth = shared_depth; + format!( + "def tree: reduce range({depth}) as $i (null; [.,.]); tree as $a | tree as $b | {}", + ["$a == $b", "[$a,$b] | sort | length", "$a | contains($b)"][byte(3) % 3] + ) + } + 9 => format!("[range({count}) | tostring] | join(\",\") | length"), + 10 => "try ({a:[1],b:[2]} | .[] |= error(\"stop\")) catch .".into(), + _ => { + let depth = shared_depth; + format!("reduce range({depth}) as $i ([]; [.,.]) | tobytes | length") + } + }; + let runtime = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap(); + runtime.block_on(async { + bashkit::testing::fuzz_init(); + let mut bash = bashkit::Bash::builder() + .limits( + bashkit::ExecutionLimits::new() + .max_commands(50) + .max_subst_depth(3) + .max_stdout_bytes(4096) + .max_stderr_bytes(4096) + .max_work_units(50_000) + .max_live_intermediate_bytes( + [16_384, 65_536, 1_048_576, 32_000_000][byte(4) % 4], + ) + .timeout(std::time::Duration::from_millis(200)), + ) + .build(); + let script = format!("jq -nc '{filter}'"); + bashkit::testing::fuzz_exec(&mut bash, &script, "jq_lifecycle_fuzz", &[]).await; + + // A fixed, non-fuzzed probe verifies that error/unwind cleanup lets the + // next host request use the same interpreter and fresh meter normally. + let probe = "jq -n '1 + 1'"; + let recovered = bash.exec(probe).await.unwrap(); + bashkit::testing::assert_fuzz_invariants(&recovered, probe, "jq_lifecycle_recovery", &[]); + assert_eq!(recovered.exit_code, 0, "{}", recovered.stderr); + assert_eq!(recovered.stdout, "2\n"); + }); +}); diff --git a/justfile b/justfile index 059ca422d..2f4de666f 100644 --- a/justfile +++ b/justfile @@ -298,6 +298,32 @@ bench-parallel: ./scripts/bench-parallel.sh pnpm --dir site run data:performance +# Compare jq backends in alternating rounds; save raw estimates and /benches data. +bench-jq *args: + python3 scripts/bench-jq.py {{args}} + +# Native jq/yq conformance with independent storage and shell execution modes. +test-jq: + cargo test --locked -p bashkit --no-default-features --features jq --lib --test integration -- jq yq + cargo test --locked -p bashkit --no-default-features --features experimental_jq --lib --test integration -- jq yq + cargo test --locked -p bashkit --no-default-features --features jq,experimental_execution_plan --lib --test integration -- jq yq + cargo test --locked -p bashkit --no-default-features --features experimental_jq,experimental_execution_plan --lib --test integration -- jq yq + +# The same discovered jq/yq lifecycle targets as native PR/nightly fuzzing. +fuzz-jq: + #!/usr/bin/env bash + set -euo pipefail + for jq_plan in "" --execution-plan; do + for jq_owned in "" --experimental-jq; do + for jq_target in jq_fuzz yq_fuzz jq_lifecycle_fuzz; do + fuzz_args=(--target "$jq_target") + [[ -z "$jq_plan" ]] || fuzz_args+=("$jq_plan") + [[ -z "$jq_owned" ]] || fuzz_args+=("$jq_owned") + python3 scripts/fuzz-smoke.py "${fuzz_args[@]}" + done + done + done + # Large-tree stress tests at millions of files (release; TM-DOS-140) stress files="2000000": BASHKIT_STRESS_FILES={{files}} cargo test --release -p bashkit --test large_tree_stress_tests -- --nocapture diff --git a/scripts/bench-jq.py b/scripts/bench-jq.py new file mode 100644 index 000000000..9441be90c --- /dev/null +++ b/scripts/bench-jq.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Build both jq backends, measure alternating pairs, and save reviewable data. + +Cargo's JSON artifacts locate executables across toolchains without depending +on private target/deps layouts. Build everything before measuring. Criterion +data and copied executables live in a private temporary directory. +""" +from __future__ import annotations + +import argparse +import json +import os +from pathlib import Path +import platform +import shutil +import statistics +import subprocess +import tempfile +import time + +ROOT = Path(__file__).resolve().parents[1] + + +def build(features: str, destination: Path, env: dict) -> None: + command = ['cargo', 'bench', '--locked', '-p', 'bashkit', '--no-default-features', + '--features', features, '--bench', 'jq', '--no-run', '--message-format=json'] + result = subprocess.run(command, cwd=ROOT, env=env, text=True, + stdout=subprocess.PIPE, check=True) + artifacts = [json.loads(line) for line in result.stdout.splitlines() if line.startswith('{')] + binaries = [row['executable'] for row in artifacts + if row.get('reason') == 'compiler-artifact' + and row.get('target', {}).get('name') == 'jq' and row.get('executable')] + if len(binaries) != 1: + raise RuntimeError(f'expected one jq benchmark executable, found {binaries}') + shutil.copy2(binaries[0], destination) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--quick', action='store_true', help='thin LTO/eight codegen units for iteration') + parser.add_argument('--rounds', type=int, default=3) + parser.add_argument('--samples', type=int, default=30) + parser.add_argument('--warmup', type=float, default=0.5) + parser.add_argument('--measurement', type=float, default=2.0) + args = parser.parse_args() + if args.rounds < 1 or args.samples < 10 or args.warmup <= 0 or args.measurement <= 0: + parser.error('positive rounds/times and at least ten samples are required') + env = os.environ.copy() + if args.quick: + env.update(CARGO_PROFILE_BENCH_LTO='thin', CARGO_PROFILE_BENCH_CODEGEN_UNITS='8') + variants = {'established': 'jq', 'experimental': 'experimental_jq'} + measurements = {name: {} for name in variants} + cpu = None + if hasattr(os, 'sched_getaffinity'): + available = sorted(os.sched_getaffinity(0)) + cpu = available[len(available) // 2] + with tempfile.TemporaryDirectory(prefix='bashkit-jq-') as scratch: + scratch = Path(scratch) + env['CRITERION_HOME'] = str(scratch / 'criterion') + executables = {name: scratch / (name + ('.exe' if os.name == 'nt' else '')) for name in variants} + for name, features in variants.items(): + build(features, executables[name], env) + for round_index in range(args.rounds): + order = list(variants) if round_index % 2 == 0 else list(reversed(variants)) + for name in order: + label = f'{name}-{round_index}' + command = [str(executables[name]), '--bench', '--noplot', '--sample-size', str(args.samples), + '--warm-up-time', str(args.warmup), '--measurement-time', str(args.measurement), + '--save-baseline', label] + print(f'Round {round_index + 1}: {name}', flush=True) + # Pin only the child; other validation work must be idle while + # recording performance. Non-Linux native hosts run unpinned. + with (scratch / f'{label}.log').open('w') as log: + subprocess.run(command, cwd=ROOT, env=env, stdout=log, + stderr=subprocess.STDOUT, check=True, + preexec_fn=(lambda: os.sched_setaffinity(0, {cpu})) if cpu is not None else None) + for case in sorted((scratch / 'criterion/jq').iterdir()): + estimates = case / label / 'estimates.json' + if estimates.exists(): + measurements[name].setdefault(case.name, []).append(json.loads(estimates.read_text())) + if set(measurements['established']) != set(measurements['experimental']) or not measurements['established']: + raise RuntimeError('both backends must report exactly the same nonempty benchmark set') + rows = [] + for case in measurements['established']: + before = measurements['established'][case] + after = measurements['experimental'][case] + if len(before) != args.rounds or len(after) != args.rounds: + raise RuntimeError(f'{case}: incomplete paired rounds') + before_ns = statistics.median(row['median']['point_estimate'] for row in before) + after_ns = statistics.median(row['median']['point_estimate'] for row in after) + rows.append({'benchmark': f'jq/{case}', 'established_median_ns': before_ns, + 'experimental_median_ns': after_ns, 'change_pct': 100 * (after_ns / before_ns - 1), + 'established_estimates': before, 'experimental_estimates': after}) + metadata = {'revision': subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip(), + 'rustc': subprocess.check_output(['rustc', '--version'], text=True).strip(), + 'platform': f'{platform.system()} {platform.machine()}', 'cpu': cpu, + 'profile_overrides': {key: value for key, value in env.items() if key.startswith('CARGO_PROFILE_BENCH_')}, + 'rounds': args.rounds, 'samples': args.samples, 'warmup_seconds': args.warmup, + 'measurement_seconds': args.measurement, 'features': variants, 'cases': rows} + destination = ROOT / f'crates/bashkit/benches/results/criterion-jq-paired-{platform.system().lower()}-{platform.machine()}-{int(time.time())}' + destination.with_suffix('.json').write_text(json.dumps(metadata, indent=2) + '\n') + lines = ['# Criterion jq Paired Backend Benchmark', '', + f"{metadata['rustc']}; {metadata['platform']}; CPU affinity: {cpu}.", + f'{args.rounds} alternating rounds, {args.samples} samples, {args.warmup}s warmup, {args.measurement}s measurement target.', + f"Bench profile overrides: `{metadata['profile_overrides']}`.", + 'Times are medians across round medians. Positive change means slower. Both backends assert identical output.', '', + '| Benchmark | Before | After | Change |', '|---|---:|---:|---:|'] + for row in rows: + lines.append(f"| `{row['benchmark']}` | {row['established_median_ns']/1e6:.3f} ms | {row['experimental_median_ns']/1e6:.3f} ms | {row['change_pct']:+.1f}% |") + lines += ['', 'Before: `jq`; after: opt-in `experimental_jq`, both without default features.', + 'All builds finish before measurement. The paired JSON retains every round\'s Criterion estimates.', + 'Reproduce with `just bench-jq` (add `--quick` for thin-LTO development measurements).', ''] + destination.with_suffix('.md').write_text('\n'.join(lines)) + print(destination.relative_to(ROOT)) + subprocess.run(['node', 'site/scripts/build-performance-data.mjs'], cwd=ROOT, check=True) + + +if __name__ == '__main__': + main() diff --git a/scripts/fuzz-smoke.py b/scripts/fuzz-smoke.py index 1732dc336..f10df649d 100644 --- a/scripts/fuzz-smoke.py +++ b/scripts/fuzz-smoke.py @@ -19,8 +19,14 @@ def matrix() -> list[dict]: for enabled in (False, True): if 'plan_differential' in required and not enabled: continue - features = required + (['experimental_execution_plan'] if enabled else []) - rows.append({'target': target['name'], 'execution_plan': enabled, 'features': ','.join(features)}) + # jq/yq value lifecycles need independent coverage of both storage + # backends. Keep unrelated runtime fuzzers out of that extra axis. + jq_modes = (False, True) if target['name'].startswith(('jq_', 'yq_')) else (False,) + for owned in jq_modes: + features = (required + (['experimental_execution_plan'] if enabled else []) + + (['experimental_jq'] if owned else [])) + rows.append({'target': target['name'], 'execution_plan': enabled, + 'experimental_jq': owned, 'features': ','.join(features)}) return rows @@ -28,6 +34,7 @@ def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--matrix', action='store_true') parser.add_argument('--execution-plan', action='store_true') + parser.add_argument('--experimental-jq', action='store_true') parser.add_argument('--target', help='Run one discovered target (default: all)') args = parser.parse_args() rows = matrix() @@ -35,6 +42,7 @@ def main() -> None: print(json.dumps({'include': rows})) return selected = [r for r in rows if r['execution_plan'] == args.execution_plan + and r['experimental_jq'] == args.experimental_jq and (args.target is None or args.target == r['target'])] if not selected: parser.error('no targets selected') diff --git a/scripts/install-jq-ci.sh b/scripts/install-jq-ci.sh index 982310f8b..eba479cd7 100755 --- a/scripts/install-jq-ci.sh +++ b/scripts/install-jq-ci.sh @@ -30,6 +30,9 @@ case "${os}:${arch}" in Darwin:aarch64 | Darwin:arm64) target="macos-arm64" ;; + MINGW*:x86_64 | MSYS*:x86_64) + target="windows-amd64.exe" + ;; *) echo "unsupported platform for pinned jq install: ${os} ${arch}" >&2 exit 1 @@ -49,6 +52,9 @@ case "${version}:${target}" in 1.8.1:macos-arm64) expected_sha256="a9fe3ea2f86dfc72f6728417521ec9067b343277152b114f4e98d8cb0e263603" ;; + 1.8.1:windows-amd64.exe) + expected_sha256="23cb60a1354eed6bcc8d9b9735e8c7b388cd1fdcb75726b93bc299ef22dd9334" + ;; *) echo "missing pinned SHA-256 for jq ${version} ${target}" >&2 exit 1 @@ -92,13 +98,23 @@ verify_sha256 "${tmp}/jq" "${expected_sha256}" # Ahead of the image's own /usr/bin/jq on PATH: GitHub prepends each # GITHUB_PATH entry, so the pinned build wins over a preinstalled one. -install_dir="${RUNNER_TOOL_CACHE:-${HOME}/.cache}/jq-${version}-${target}/bin" +cache_root="${RUNNER_TOOL_CACHE:-${HOME}/.cache}" +installed_binary=jq +if [[ "$target" == windows-* ]]; then + cache_root="$(cygpath -u "$cache_root")" + installed_binary=jq.exe +fi +install_dir="${cache_root}/jq-${version}-${target}/bin" mkdir -p "${install_dir}" -cp "${tmp}/jq" "${install_dir}/jq" -chmod +x "${install_dir}/jq" +cp "${tmp}/jq" "${install_dir}/${installed_binary}" +chmod +x "${install_dir}/${installed_binary}" if [[ -n "${GITHUB_PATH:-}" ]]; then - echo "${install_dir}" >> "${GITHUB_PATH}" + if [[ "$target" == windows-* ]]; then + cygpath -w "$install_dir" >> "$GITHUB_PATH" + else + echo "${install_dir}" >> "${GITHUB_PATH}" + fi fi -"${install_dir}/jq" --version +"${install_dir}/${installed_binary}" --version diff --git a/scripts/tests/test_experimental_jq_ci.py b/scripts/tests/test_experimental_jq_ci.py new file mode 100644 index 000000000..c98d30c5a --- /dev/null +++ b/scripts/tests/test_experimental_jq_ci.py @@ -0,0 +1,80 @@ +"""The owned jq backend must execute the same native gates as the stable one.""" +import importlib.util +from pathlib import Path +import tomllib +import unittest + +import yaml + +ROOT = Path(__file__).resolve().parents[2] +spec = importlib.util.spec_from_file_location('jq_fuzz_smoke', ROOT / 'scripts/fuzz-smoke.py') +fuzz = importlib.util.module_from_spec(spec) +spec.loader.exec_module(fuzz) + + +def jobs(workflow): + return yaml.safe_load((ROOT / '.github/workflows' / workflow).read_text())['jobs'] + + +def commands(job): + return '\n'.join(str(step.get('run', '')) for step in job['steps']) + + +class ExperimentalJqCI(unittest.TestCase): + def test_every_embedding_forwards_the_opt_in_feature(self): + for crate in ['cli', 'capi', 'python', 'js', 'wasm', 'scripted-tool', 'bench', 'eval']: + with self.subTest(crate=crate): + manifest = tomllib.loads((ROOT / f'crates/bashkit-{crate}/Cargo.toml').read_text()) + self.assertEqual(manifest.get('features', {}).get('experimental_jq'), + ['bashkit/experimental_jq']) + self.assertNotIn('experimental_jq', manifest.get('features', {}).get('default', [])) + + def test_required_native_matrix_executes_both_backends_and_plans(self): + ci = jobs('ci.yml') + job = ci['jq-native'] + matrix = job['strategy']['matrix'] + self.assertEqual(set(matrix['experimental_jq']), {False, True}) + self.assertEqual(set(matrix['execution_plan']), {False, True}) + self.assertEqual(set(matrix['os']), {'ubuntu-24.04', 'macos-latest', 'windows-latest'}) + run = commands(job) + for token in ['--lib --test integration', 'experimental_jq', 'experimental_execution_plan', + 'security_failpoint_tests', '--test-threads=1', 'jq yq']: + self.assertIn(token, run) + self.assertIn('jq-native', ci['check']['needs']) + self.assertIn('needs.jq-native.result', commands(ci['check'])) + + def test_fuzz_smoke_and_scheduled_fuzzing_select_owned_rows(self): + rows = fuzz.matrix() + for target in ['jq_fuzz', 'yq_fuzz', 'jq_lifecycle_fuzz']: + with self.subTest(target=target): + selected = [row for row in rows if row['target'] == target] + self.assertEqual({(row['execution_plan'], row.get('experimental_jq', False)) + for row in selected}, + {(False, False), (False, True), (True, False), (True, True)}) + for row in selected: + self.assertEqual('experimental_jq' in row['features'].split(','), + row['experimental_jq']) + smoke = jobs('ci.yml')['fuzz-check'] + self.assertIn(True, smoke['strategy']['matrix']['experimental_jq']) + self.assertIn('--experimental-jq', commands(smoke)) + scheduled = jobs('fuzz.yml') + self.assertIn('scripts/fuzz-smoke.py --matrix', commands(scheduled['targets'])) + self.assertIn('matrix.experimental_jq', str(scheduled['fuzz'])) + + def test_sanitizers_miri_and_coverage_exercise_owned_storage(self): + nightly = jobs('nightly.yml') + for name in ['asan', 'miri']: + self.assertIn('experimental_jq', commands(nightly[name])) + self.assertIn('owning_iterator_keeps_storage_charged_until_drop', commands(nightly['miri'])) + coverage = jobs('coverage.yml')['coverage'] + self.assertEqual(set(coverage['strategy']['matrix']['experimental_jq']), {False, True}) + self.assertIn('experimental_jq', commands(coverage)) + + def test_binding_and_browser_binaries_run_the_owned_backend(self): + for workflow in ['ci.yml', 'python.yml', 'js.yml']: + text = (ROOT / '.github/workflows' / workflow).read_text() + self.assertIn('bashkit/experimental_execution_plan,bashkit/experimental_jq', text) + + +if __name__ == '__main__': + unittest.main() From c2898afe12db5db899f5a46640184de4c7725a81 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 15:45:55 -0600 Subject: [PATCH 05/12] chore(knowledge): document owned jq performance and native validation --- knowledge/operations/performance-results.md | 7 +++++ knowledge/operations/testing.md | 31 +++++++++++++++++++++ knowledge/runtimes/jaq-json-vendor.md | 29 ++++++++++++++----- 3 files changed, 60 insertions(+), 7 deletions(-) diff --git a/knowledge/operations/performance-results.md b/knowledge/operations/performance-results.md index 5319eebb2..194955591 100644 --- a/knowledge/operations/performance-results.md +++ b/knowledge/operations/performance-results.md @@ -49,6 +49,13 @@ Save a new Criterion benchmark's first run as a baseline using Run a single Criterion benchmark with `cargo bench -p bashkit --bench `. +`just bench-jq` builds both jq backends before measuring, pins a measurement +CPU where supported, alternates run order across three paired rounds, and saves +all Criterion estimates plus a Markdown comparison. It locates executables via +Cargo's JSON artifact API rather than private target layouts. `--quick` uses +thin LTO/eight codegen units for hill climbing; compare builds within the same +profile and record final results with the repository's ordinary bench profile. + Default benchmark recipes that represent a real run MUST save artifacts in the directories above: `just bench`, `just bench-parallel`, `just bench-sqlite`, `just bench-python`, `just gaps`, `just oils-spec`. diff --git a/knowledge/operations/testing.md b/knowledge/operations/testing.md index 52e4879a9..e2bc20e90 100644 --- a/knowledge/operations/testing.md +++ b/knowledge/operations/testing.md @@ -86,6 +86,37 @@ intermediate-artifact layout; scripts must not depend on internal build/deps paths. The consumer's own lockfile is used after fresh resolution, so this check catches dependency-floor drift hidden by the workspace's locked graph. +## Native jq backend coverage + +`experimental_jq` remains off by default and is forwarded by every embedding +crate. Required CI runs jq/yq compatibility, lifecycle and shared-budget tests +plus serialized security failpoints on Linux, macOS and Windows with independent +storage-backend and execution-plan axes. The Windows oracle uses pinned native +jq with binary output, preserving Bashkit's platform-independent LF streams. +Generated-depth and exponential-traversal regressions run in supervised 2 MiB +children on all three hosts; Unix adds CPU/RSS caps to the wall/output watchdog. + +Binding/browser instrumented rows enable both experiments together to test the +actual language artifacts without doubling every version/architecture matrix; +the independent native matrix isolates each flag. Native release defaults do +not enable either experiment. Rust coverage retains independent axes, nightly +ASan executes jq/yq under the owned feature, and Miri exercises storage/refund +and iterator-lifetime invariants. `scripts/tests/test_experimental_jq_ci.py` +guards those gates and feature forwarding against silent omissions. + +`just test-jq` runs the four native mode combinations. `just fuzz-jq` runs all +three jq/yq targets across both independent axes. Discovery adds owned rows +only to jq/yq targets, preserving other runtime fuzz coverage without duplicating +unrelated interpreters. Scheduled fuzzing consumes that same matrix. +`jq_lifecycle_fuzz` supplies structured construction, updates, COW, merge, +comparison, byte conversion, formatting, resource failures and session recovery; +the two native-model property tests check container semantics and full storage +refunds against independent `Vec`/`BTreeMap` models. + +See [Vendored jaq-json](../runtimes/jaq-json-vendor.md) and +[Performance Results](performance-results.md) for the owned boundary and paired +benchmark commands. + ## Experimental execution-plan coverage The normal CI test job has interpreter and execution-plan matrix rows. The latter diff --git a/knowledge/runtimes/jaq-json-vendor.md b/knowledge/runtimes/jaq-json-vendor.md index cfe5b60ae..dcb502978 100644 --- a/knowledge/runtimes/jaq-json-vendor.md +++ b/knowledge/runtimes/jaq-json-vendor.md @@ -39,13 +39,14 @@ copy can go back to being a dependency. ### Experimental owned boundary -`experimental_jq` is an opt-in Cargo feature on `bashkit` and `bashkit-cli`. +`experimental_jq` is an opt-in Cargo feature on `bashkit`, the CLI, and every +embedding crate (C, Python, JavaScript, browser/WASI, scripted tools and runners). It implies `jq`; no default or existing feature enables it. Both jq and yq use the selected value runtime. The first owned layer is array/object storage in `builtins/jq/owned.rs`, compiled and linted as Bashkit code outside the vendored module. This deliberately reuses jaq's parser, evaluator, standard library, value arithmetic and Bashkit's compatibility definitions. It is not -a replacement jq language implementation or a performance claim. +a replacement jq language implementation. The [first paired benchmark](../../crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md) records about 9% overhead for array updates and 13% for object updates in an @@ -58,6 +59,13 @@ mutable child references and unchecked growth. Type-specific set, insert, splice, append, remove and merge operations check child depth before attachment, invalidate depth on mutation, admit capacity growth before reserve, and resync charges before returning. COW cloning admits the copied body before allocation. +Array growth uses geometric capacity with an exact-size fallback when spare +capacity would exceed the remaining budget. COW copies do not rescan unchanged, +already admitted children. Object updates take and replace a child through one +checked entry lookup; callbacks cannot retain mutable entry handles, and absent +updates returning no value or an error do not allocate a table. The shared +polling hot path advances a thread-local `Cell`, borrowing its callback only +every 4096 operations; nested meter guards restore the previous poll progress. Array/object collection, `fromjson`, input/global conversion and whole-object updates build incrementally charged containers. Subtraction uses a charged sorted reference index. The low-level meter and @@ -97,15 +105,22 @@ The host resets its cancellation token before that next request, as required by the public token contract. `diff_owned_container_lifecycle` compares construction, mutation/COW, merge, traversal, comparison, formatting and error -cleanup with real jq. CI exercises the experimental configuration separately. +cleanup with pinned real jq. Native model proptests compare mutation and COW +with Rust `Vec`/`BTreeMap` and require complete storage refunds. The required +native CI matrix independently sweeps both storage and shell execution flags +on Linux, macOS and Windows, including a native CLI smoke test and serialized +security fault injection. Binding/browser package tests also execute owned jq; +coverage, ASan, Miri and manifest-discovered fuzzing include it explicitly. +`jq_lifecycle_fuzz` generates valid mutation, shared-tree traversal, formatting, +depth and cleanup cases, then verifies same-interpreter recovery. This is +first-class native validation, not a claim of 100% code or language coverage. Keep vendor sync patches at the selection/call sites; `owned.rs` is maintained by Bashkit rather than overwritten from upstream. ```bash -cargo test -p bashkit --no-default-features --features experimental_jq --lib --test integration -- jq yq -cargo bench -p bashkit --no-default-features --features experimental_jq --bench jq -# From crates/bashkit/fuzz, with cargo-fuzz and a supported nightly: -cargo +nightly fuzz run jq_fuzz --features experimental_jq +just test-jq +just bench-jq +just fuzz-jq ``` | Path | Content | From 6a7e7cec15284ba3cd4880a69a947a6ceec79c50 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 15:52:41 -0600 Subject: [PATCH 06/12] chore(knowledge): record native jq lifecycle security gates --- knowledge/security/security-testing.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/knowledge/security/security-testing.md b/knowledge/security/security-testing.md index 85e16fc2e..c180589b5 100644 --- a/knowledge/security/security-testing.md +++ b/knowledge/security/security-testing.md @@ -64,6 +64,20 @@ incremental charging and drop refunds. Its mutation differential corpus uses real jq as the oracle, with memory/depth limits as deliberate exceptions. See [Vendored jaq-json](../runtimes/jaq-json-vendor.md#experimental-owned-boundary). +`jq_lifecycle_fuzz` supplies valid construction, mutation, COW, merge, +comparison, formatting and cleanup cases to both storage backends and both +shell execution modes. Every input ends with a recovery probe on the same +interpreter. Native model properties compare checked mutations with Rust +containers and require full ledger refunds. Nightly Miri checks admission, +unwind/refund and owning-iterator lifetimes; ASan executes the jq/yq suites. + +Both backends must interrupt exponential traversal of depth-bounded shared +trees. Small deterministic polling tests cover equality, ordering, hashing, +containment, byte conversion and formatting. A supervised 60-level DAG test +also verifies the real deadline and subsequent recovery. The required native +matrix runs these tests on Linux, macOS and Windows with pinned jq 1.8.1 as +the compatibility oracle. See [Native jq backend coverage](../operations/testing.md#native-jq-backend-coverage). + `memory_growth_security_tests::jq` checks depth 100/101 independently of heap, output and evaluator recursion limits. It covers new containers, index updates, slice updates, shared subtrees, removal/COW cache invalidation, `fromjson`, From b00b168aa97944f0cf67a09dccae55c4bdd79850 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 18:17:52 -0600 Subject: [PATCH 07/12] test(jq): stabilize lifecycle fuzz recovery and native checks --- .github/workflows/nightly.yml | 9 +- ...ion-jq-paired-linux-x86_64-1795651774.json | 4205 +++++++++++++++++ ...erion-jq-paired-linux-x86_64-1795651774.md | 28 + .../fuzz/fuzz_targets/jq_lifecycle_fuzz.rs | 11 +- crates/bashkit/src/builtins/jq/owned/tests.rs | 27 +- crates/bashkit/src/fs/realfs.rs | 8 +- knowledge/operations/limitations.md | 1 + knowledge/runtimes/jaq-json-vendor.md | 9 + site/src/data/performance-timeline.json | 37 +- 9 files changed, 4328 insertions(+), 7 deletions(-) create mode 100644 crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.json create mode 100644 crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0fe07eee9..7e5ffad29 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -239,9 +239,16 @@ jobs: RUSTFLAGS: "-Z sanitizer=address" ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=0" run: | + # The default ASan pass above owns the long throughput workloads + # and strict 300-ms timeout test. Avoid running those twice in this + # instrumented owned-container slice. cargo +nightly-2026-10-30 test --features="experimental_jq${{ matrix.execution_plan && ',experimental_execution_plan' || '' }}" \ -Z build-std --target x86_64-unknown-linux-gnu -p bashkit --no-default-features --lib --test integration -- \ - --test-threads=1 jq yq + --test-threads=1 jq yq \ + --skip growth_inside_one_evaluation_stops_at_the_limit \ + --skip non_emitting_loop_stops_at_the_timeout \ + --skip ordinary_workloads_still_fit \ + --skip unbounded_generator_is_capped # The default-feature run above leaves out embedded python3. The Monty # forks (crates/bashkit-monty*) are our code now, with unsafe in the diff --git a/crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.json b/crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.json new file mode 100644 index 000000000..3691116e9 --- /dev/null +++ b/crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.json @@ -0,0 +1,4205 @@ +{ + "revision": "f308835c65454b0f5666a2686a4e57027dbdd1a8", + "rustc": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "platform": "Linux x86_64", + "cpu": 2, + "profile_overrides": {}, + "rounds": 3, + "samples": 20, + "warmup_seconds": 0.3, + "measurement_seconds": 1.0, + "features": { + "established": "jq", + "experimental": "experimental_jq" + }, + "cases": [ + { + "benchmark": "jq/aggregate_4096_rows", + "established_median_ns": 11063600.399999999, + "experimental_median_ns": 11474130.9, + "change_pct": 3.710641067622089, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10945290.258999998, + "upper_bound": 11084198.970250001 + }, + "point_estimate": 11010161.05, + "standard_error": 35550.65741151471 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10921947.0, + "upper_bound": 11037443.7 + }, + "point_estimate": 10997685.0, + "standard_error": 30670.173451581784 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 48817.569333314896, + "upper_bound": 215739.5010563588 + }, + "point_estimate": 127133.83730292403, + "standard_error": 46325.89361341171 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 90333.4672273802, + "upper_bound": 221157.49332528503 + }, + "point_estimate": 162409.39347790374, + "standard_error": 34924.782601374616 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11239540.175249998, + "upper_bound": 11688704.449749999 + }, + "point_estimate": 11430778.190000001, + "standard_error": 116205.558213039 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11169174.899999999, + "upper_bound": 11326736.600000001 + }, + "point_estimate": 11262776.9, + "standard_error": 48239.54999664547 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 64702.1454513073, + "upper_bound": 363126.09507322474 + }, + "point_estimate": 162125.27232170242, + "standard_error": 81078.23599992415 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 181643.1349001512, + "upper_bound": 791391.2080785417 + }, + "point_estimate": 531610.1403332073, + "standard_error": 175857.17223888246 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11048005.129749998, + "upper_bound": 11669910.27525 + }, + "point_estimate": 11316819.809999999, + "standard_error": 160436.3476164911 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10956920.9, + "upper_bound": 11255239.6 + }, + "point_estimate": 11063600.399999999, + "standard_error": 84096.15218929075 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 105716.19808316314, + "upper_bound": 415141.929069758 + }, + "point_estimate": 267902.85004377365, + "standard_error": 79712.6328869441 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 175569.6544722372, + "upper_bound": 1046147.9407297613 + }, + "point_estimate": 737622.1363133024, + "standard_error": 232680.45182581275 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11790033.021750003, + "upper_bound": 12014990.5505 + }, + "point_estimate": 11896380.970000003, + "standard_error": 57804.18958601748 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11730763.0, + "upper_bound": 11918479.7 + }, + "point_estimate": 11828087.3, + "standard_error": 57232.380621225726 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 94547.92074143914, + "upper_bound": 349037.8370833394 + }, + "point_estimate": 198715.39489209678, + "standard_error": 69449.54017223774 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 153636.78921938085, + "upper_bound": 333676.9074621632 + }, + "point_estimate": 265656.51000215154, + "standard_error": 45604.218821094204 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11424392.098437501, + "upper_bound": 11551467.1190625 + }, + "point_estimate": 11484938.1375, + "standard_error": 32398.84875234089 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11381708.25, + "upper_bound": 11566747.5 + }, + "point_estimate": 11434491.0, + "standard_error": 64993.194324367 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 38727.54988744855, + "upper_bound": 236978.59446778893 + }, + "point_estimate": 155996.01870551705, + "standard_error": 53904.69062379055 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 96867.54047696623, + "upper_bound": 190470.18024896877 + }, + "point_estimate": 148031.87032424443, + "standard_error": 24994.476197787564 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11407857.2445, + "upper_bound": 11666554.60425 + }, + "point_estimate": 11511397.7, + "standard_error": 68640.65318189035 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11391816.8, + "upper_bound": 11525805.9 + }, + "point_estimate": 11474130.9, + "standard_error": 39177.489536848625 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30899.60735142231, + "upper_bound": 203775.2120822668 + }, + "point_estimate": 92799.78711247527, + "standard_error": 41421.04845941151 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 88685.20685390595, + "upper_bound": 502422.5573267179 + }, + "point_estimate": 314335.51471340447, + "standard_error": 133897.23529968603 + } + } + ] + }, + { + "benchmark": "jq/array_concat", + "established_median_ns": 1168995.9246794872, + "experimental_median_ns": 1310862.215544872, + "change_pct": 12.135738702791565, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1159650.663708542, + "upper_bound": 1213300.7030398643 + }, + "point_estimate": 1180327.7976094917, + "standard_error": 14472.930843820614 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1155465.71875, + "upper_bound": 1167126.775 + }, + "point_estimate": 1162622.6428571427, + "standard_error": 3325.7602872359475 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 5035.465485602617, + "upper_bound": 19017.39325862364 + }, + "point_estimate": 12339.567062178696, + "standard_error": 3773.365229339466 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1162084.6714654018, + "upper_bound": 1269010.422315077 + }, + "point_estimate": 1205617.2342334494, + "standard_error": 29206.01006055978 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8162.731709435732, + "upper_bound": 104731.39040804241 + }, + "point_estimate": 66234.31574359763, + "standard_error": 29944.33359755335 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1178869.2958371008, + "upper_bound": 1237456.1335197357 + }, + "point_estimate": 1200317.493080676, + "standard_error": 16979.942174907625 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1176224.203125, + "upper_bound": 1192804.775 + }, + "point_estimate": 1187124.1092105263, + "standard_error": 4709.1364067867125 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7699.6000988310525, + "upper_bound": 22516.34754731355 + }, + "point_estimate": 14867.165051680058, + "standard_error": 3697.311518358476 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1185043.9979172589, + "upper_bound": 1241097.2387887186 + }, + "point_estimate": 1204515.1448606271, + "standard_error": 15228.909676823016 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10398.582705373967, + "upper_bound": 127516.29736366506 + }, + "point_estimate": 77825.00583164746, + "standard_error": 41037.075584887614 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1163978.2323041297, + "upper_bound": 1205045.8557301338 + }, + "point_estimate": 1180339.4219090794, + "standard_error": 10998.741012171744 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1161072.6417410714, + "upper_bound": 1176924.9270833335 + }, + "point_estimate": 1168995.9246794872, + "standard_error": 3915.763606394046 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6743.850364888039, + "upper_bound": 30490.98426617675 + }, + "point_estimate": 16185.768144015463, + "standard_error": 6140.63102585489 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1168064.2421276905, + "upper_bound": 1208320.4959815815 + }, + "point_estimate": 1184204.1460801393, + "standard_error": 10378.870761085744 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 12982.311250076238, + "upper_bound": 80666.11951969842 + }, + "point_estimate": 50605.1655879376, + "standard_error": 21786.468798457907 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1307399.3330683943, + "upper_bound": 1492829.1884619042 + }, + "point_estimate": 1372920.5535429607, + "standard_error": 55607.00441778966 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1303236.8585858585, + "upper_bound": 1319464.0439814816 + }, + "point_estimate": 1310862.215544872, + "standard_error": 4854.97993550836 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7073.957458755374, + "upper_bound": 26163.71629105706 + }, + "point_estimate": 14435.270021340017, + "standard_error": 5007.553255451654 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1304243.2627835781, + "upper_bound": 1766990.649694047 + }, + "point_estimate": 1468268.2722415796, + "standard_error": 139598.82989002563 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11522.308234079905, + "upper_bound": 418435.4781693569 + }, + "point_estimate": 255330.8165822918, + "standard_error": 141663.05251826852 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1296643.0237102692, + "upper_bound": 1345065.7967805157 + }, + "point_estimate": 1314194.7894352204, + "standard_error": 14182.348770753271 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1296540.023026316, + "upper_bound": 1303331.7083333335 + }, + "point_estimate": 1298578.145192308, + "standard_error": 1797.9335954599546 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2574.3462779804036, + "upper_bound": 13866.948988428154 + }, + "point_estimate": 6655.400627292043, + "standard_error": 2741.6801617976575 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1296801.2061984031, + "upper_bound": 1398275.0313731653 + }, + "point_estimate": 1331020.906881533, + "standard_error": 30089.280157125493 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6671.799160180505, + "upper_bound": 106187.41505233056 + }, + "point_estimate": 64774.169306685566, + "standard_error": 34737.45419100596 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1309744.6431893033, + "upper_bound": 1366513.1187588216 + }, + "point_estimate": 1334258.548505289, + "standard_error": 14683.44613498496 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1301866.0598739497, + "upper_bound": 1334042.2868421054 + }, + "point_estimate": 1314921.5921875, + "standard_error": 9520.058877740325 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14276.987152415095, + "upper_bound": 53268.80346909774 + }, + "point_estimate": 31090.311406161705, + "standard_error": 9977.476521915487 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1312060.8348677764, + "upper_bound": 1394584.6962696288 + }, + "point_estimate": 1350179.7484320558, + "standard_error": 21431.938943416735 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 22620.793160182402, + "upper_bound": 99229.00548297554 + }, + "point_estimate": 67553.84066285797, + "standard_error": 21127.490560397848 + } + } + ] + }, + { + "benchmark": "jq/array_copy_on_write", + "established_median_ns": 2999866.958333333, + "experimental_median_ns": 2999216.6944444445, + "change_pct": -0.021676424252159432, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2991416.8491479796, + "upper_bound": 3101118.503431345 + }, + "point_estimate": 3034039.3448065864, + "standard_error": 29853.084311296836 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2982062.351010101, + "upper_bound": 3034134.1450892854 + }, + "point_estimate": 2989349.988888889, + "standard_error": 13453.914687496006 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13101.880109061836, + "upper_bound": 68146.49129785025 + }, + "point_estimate": 31961.85831548043, + "standard_error": 14571.776893338343 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2990689.5651910687, + "upper_bound": 3188824.5041252654 + }, + "point_estimate": 3059849.256968641, + "standard_error": 56369.45537755033 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 28398.21132297764, + "upper_bound": 219491.12654281975 + }, + "point_estimate": 136827.45031777266, + "standard_error": 62516.14670499421 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3081075.541536359, + "upper_bound": 3302230.348160782 + }, + "point_estimate": 3183238.838625458, + "standard_error": 56724.67068033359 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3034049.921875, + "upper_bound": 3152116.281818182 + }, + "point_estimate": 3066106.1696428573, + "standard_error": 33518.873929773996 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 27055.622744666827, + "upper_bound": 220923.8337846128 + }, + "point_estimate": 74580.56213968048, + "standard_error": 50172.45876235984 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3081100.651130171, + "upper_bound": 3416703.8021823806 + }, + "point_estimate": 3232228.1660278747, + "standard_error": 86062.5323500526 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 131653.71435771516, + "upper_bound": 325076.0405203172 + }, + "point_estimate": 260417.0987371431, + "standard_error": 49151.740184842885 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2994798.908635637, + "upper_bound": 3070445.9068152616 + }, + "point_estimate": 3029494.401918323, + "standard_error": 19424.77349599895 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2979551.198529412, + "upper_bound": 3020962.325 + }, + "point_estimate": 2999866.958333333, + "standard_error": 11587.468582951704 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18375.421292520597, + "upper_bound": 83719.90538867467 + }, + "point_estimate": 38821.77301735459, + "standard_error": 17416.044539423012 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2978389.2664382453, + "upper_bound": 3026032.970120909 + }, + "point_estimate": 2996047.3294425085, + "standard_error": 12352.527004404541 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 42225.36541659833, + "upper_bound": 115618.66953141494 + }, + "point_estimate": 89053.84547976787, + "standard_error": 18568.216832963688 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2995075.7757842494, + "upper_bound": 3410686.939633474 + }, + "point_estimate": 3144485.4744997965, + "standard_error": 122528.05384417201 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2984585.265151515, + "upper_bound": 3009443.375 + }, + "point_estimate": 2997707.010416667, + "standard_error": 7731.812861902163 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10344.964866340046, + "upper_bound": 62677.77101537213 + }, + "point_estimate": 34092.092963494935, + "standard_error": 15793.873671434283 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2992922.366583204, + "upper_bound": 3800782.435568029 + }, + "point_estimate": 3255989.993205575, + "standard_error": 237542.15158318236 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 36154.70420471987, + "upper_bound": 916087.6251027111 + }, + "point_estimate": 559725.284194973, + "standard_error": 302070.2112074384 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3046441.7766008466, + "upper_bound": 3220781.1563342754 + }, + "point_estimate": 3119217.025623015, + "standard_error": 45534.0392916192 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3021932.15, + "upper_bound": 3096275.05 + }, + "point_estimate": 3066120.323529412, + "standard_error": 23885.71594004097 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 38379.95214332607, + "upper_bound": 166055.42246192708 + }, + "point_estimate": 67027.4830747308, + "standard_error": 33331.716034414654 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3026781.5379740302, + "upper_bound": 3318441.0992741436 + }, + "point_estimate": 3148736.420209059, + "standard_error": 77158.90335806762 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 69443.53328524255, + "upper_bound": 323251.2426056781 + }, + "point_estimate": 209770.39147324188, + "standard_error": 77880.83792108906 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3012794.391293131, + "upper_bound": 3122091.9410097073 + }, + "point_estimate": 3063716.515266816, + "standard_error": 28089.460578837232 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2982621.840909091, + "upper_bound": 3097911.3638888886 + }, + "point_estimate": 2999216.6944444445, + "standard_error": 30104.039481649867 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18988.6256712178, + "upper_bound": 165626.52688120757 + }, + "point_estimate": 51337.16768108304, + "standard_error": 38639.44253624784 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3039208.9582328647, + "upper_bound": 3183827.892535779 + }, + "point_estimate": 3107688.4421602786, + "standard_error": 36899.57494644974 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 72024.13421938285, + "upper_bound": 159934.42624481663 + }, + "point_estimate": 128365.28208526205, + "standard_error": 22240.50234247735 + } + } + ] + }, + { + "benchmark": "jq/array_updates_4096", + "established_median_ns": 3437780.3095238097, + "experimental_median_ns": 3436651.204248366, + "change_pct": -0.032844020669842156, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3421604.615608109, + "upper_bound": 3467169.3485168684 + }, + "point_estimate": 3442740.5222349293, + "standard_error": 11708.486905332811 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3411298.333333333, + "upper_bound": 3455331.145833333 + }, + "point_estimate": 3430158.604700855, + "standard_error": 11979.214762207745 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18521.12356733828, + "upper_bound": 67328.69985551025 + }, + "point_estimate": 37320.808820435486, + "standard_error": 11470.767630256874 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3424962.657050113, + "upper_bound": 3500482.0914787604 + }, + "point_estimate": 3459724.03554007, + "standard_error": 20042.110703168808 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 26559.38853121853, + "upper_bound": 70809.73952456142 + }, + "point_estimate": 53742.565143686596, + "standard_error": 11273.327530378441 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3773906.4294514856, + "upper_bound": 4142546.2481740937 + }, + "point_estimate": 3947099.5133749866, + "standard_error": 94555.01129231937 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3716545.4535714285, + "upper_bound": 4030509.222222222 + }, + "point_estimate": 3862067.325, + "standard_error": 83507.57130326518 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 137486.68465912342, + "upper_bound": 619406.8102669851 + }, + "point_estimate": 403647.3685388264, + "standard_error": 121867.81158150204 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3873298.3262224537, + "upper_bound": 4442542.780070297 + }, + "point_estimate": 4140549.088327526, + "standard_error": 147774.7077083419 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 254421.42935734396, + "upper_bound": 559117.669046659 + }, + "point_estimate": 433455.33422903315, + "standard_error": 78883.90104873783 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3431252.612416132, + "upper_bound": 3485996.0970926723 + }, + "point_estimate": 3455926.7182836407, + "standard_error": 14082.79118802627 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3419290.7163865548, + "upper_bound": 3459905.25 + }, + "point_estimate": 3437780.3095238097, + "standard_error": 9114.03404869639 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17376.323204008448, + "upper_bound": 73019.79899530533 + }, + "point_estimate": 36535.464051365736, + "standard_error": 13096.631008604474 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3423994.5239803484, + "upper_bound": 3532969.439061325 + }, + "point_estimate": 3473759.6085365852, + "standard_error": 29158.886624558058 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 29893.41719595948, + "upper_bound": 90563.85665690029 + }, + "point_estimate": 64571.071462502245, + "standard_error": 16525.4111558257 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3429061.8938794755, + "upper_bound": 3472958.497652985 + }, + "point_estimate": 3449743.3102262774, + "standard_error": 11217.173969467724 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3419046.625, + "upper_bound": 3455216.3208333333 + }, + "point_estimate": 3437854.236111111, + "standard_error": 8486.750322122807 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13556.572929323225, + "upper_bound": 72378.41183252628 + }, + "point_estimate": 39078.870483711224, + "standard_error": 13636.99387632282 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3429468.683951434, + "upper_bound": 3463173.083080423 + }, + "point_estimate": 3444881.081707317, + "standard_error": 8571.865486803403 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 29914.05001533093, + "upper_bound": 65575.43047114956 + }, + "point_estimate": 51465.37247271345, + "standard_error": 9210.137304603439 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3417637.0882352516, + "upper_bound": 3562754.7173797903 + }, + "point_estimate": 3472066.9954948747, + "standard_error": 40713.524492657285 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3412406.810416667, + "upper_bound": 3446328.925 + }, + "point_estimate": 3436651.204248366, + "standard_error": 8116.930837467768 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10986.176999956646, + "upper_bound": 62764.947500159964 + }, + "point_estimate": 28209.57166055271, + "standard_error": 13392.326680063714 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3425863.8453043313, + "upper_bound": 3562758.9376752228 + }, + "point_estimate": 3470710.9649825785, + "standard_error": 37414.39980847598 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 27751.734302795503, + "upper_bound": 304096.2084305362 + }, + "point_estimate": 186781.31027868245, + "standard_error": 92833.72102510453 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3386879.703706583, + "upper_bound": 3414764.8189978325 + }, + "point_estimate": 3400575.489427571, + "standard_error": 7126.828841694224 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3380380.3774509802, + "upper_bound": 3425452.3934210525 + }, + "point_estimate": 3396163.81875, + "standard_error": 10163.957795320348 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14599.717915803194, + "upper_bound": 51498.9412402564 + }, + "point_estimate": 37546.75784841178, + "standard_error": 10510.94098198591 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3386842.9659342244, + "upper_bound": 3417739.114036005 + }, + "point_estimate": 3401520.7966898954, + "standard_error": 7902.67758176192 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 23402.6816377837, + "upper_bound": 39382.343388090434 + }, + "point_estimate": 32842.12298820728, + "standard_error": 4086.300517014893 + } + } + ] + }, + { + "benchmark": "jq/distinct_filters", + "established_median_ns": 31126943.25, + "experimental_median_ns": 30703033.75, + "change_pct": -1.3618732061009609, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30852539.14375, + "upper_bound": 31850065.52125 + }, + "point_estimate": 31253379.025, + "standard_error": 262498.15920486354 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30783212.75, + "upper_bound": 31089015.0 + }, + "point_estimate": 30958985.5, + "standard_error": 91720.01090605381 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 161724.97032880783, + "upper_bound": 743778.1526952982 + }, + "point_estimate": 352523.7261414528, + "standard_error": 164408.48337620962 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 299324.3857035192, + "upper_bound": 1898042.7929753286 + }, + "point_estimate": 1208948.5795227676, + "standard_error": 496286.435228609 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 31952212.475, + "upper_bound": 34743494.11 + }, + "point_estimate": 33272602.95, + "standard_error": 716974.7112222867 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 31026620.5, + "upper_bound": 33989160.5 + }, + "point_estimate": 31776563.5, + "standard_error": 750917.4797466124 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 684491.203647852, + "upper_bound": 4667967.499727011 + }, + "point_estimate": 1907404.155036807, + "standard_error": 946625.1163919192 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1979792.388215696, + "upper_bound": 3999809.3001461774 + }, + "point_estimate": 3293090.6755060027, + "standard_error": 520014.2088509599 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30971387.541875, + "upper_bound": 31447237.51625 + }, + "point_estimate": 31204456.825, + "standard_error": 121538.9478431515 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30923263.0, + "upper_bound": 31359757.5 + }, + "point_estimate": 31126943.25, + "standard_error": 119717.47262244496 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 213267.55841374397, + "upper_bound": 898537.4976977706 + }, + "point_estimate": 430665.6403541565, + "standard_error": 169374.24304289708 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 370226.3544381643, + "upper_bound": 683650.5319595138 + }, + "point_estimate": 557041.6802244427, + "standard_error": 79334.64624362535 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30681069.28625, + "upper_bound": 31484864.690625 + }, + "point_estimate": 31030181.1, + "standard_error": 207814.27285901055 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30564223.0, + "upper_bound": 30943985.5 + }, + "point_estimate": 30703033.75, + "standard_error": 105697.07627921214 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 136685.33937335014, + "upper_bound": 778836.8236228824 + }, + "point_estimate": 331687.6367613673, + "standard_error": 176866.44732313877 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 350934.3840131048, + "upper_bound": 1398472.6132815846 + }, + "point_estimate": 953706.1792866236, + "standard_error": 295452.0450416988 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30910224.395625, + "upper_bound": 32321874.748124998 + }, + "point_estimate": 31436595.55, + "standard_error": 401922.35235401295 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30775855.25, + "upper_bound": 31344606.5 + }, + "point_estimate": 31006981.0, + "standard_error": 128635.54200099247 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 187113.3829280734, + "upper_bound": 621305.016669631 + }, + "point_estimate": 480804.206264019, + "standard_error": 114912.60605364972 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 265007.83685685234, + "upper_bound": 2994833.54524382 + }, + "point_estimate": 1838107.577991674, + "standard_error": 930322.9341980751 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30639646.46125, + "upper_bound": 31498180.34375 + }, + "point_estimate": 30989385.825, + "standard_error": 225527.83846308288 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30545641.25, + "upper_bound": 30892935.5 + }, + "point_estimate": 30642003.0, + "standard_error": 112847.30732295831 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 170112.0383799076, + "upper_bound": 753827.3728431326 + }, + "point_estimate": 372032.5178951025, + "standard_error": 134219.43129015103 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 302009.3486246721, + "upper_bound": 1619823.1333522084 + }, + "point_estimate": 1035210.240253644, + "standard_error": 412368.0981041399 + } + } + ] + }, + { + "benchmark": "jq/hot_and_unique_filters", + "established_median_ns": 16968194.666666664, + "experimental_median_ns": 17133785.166666664, + "change_pct": 0.9758875546453716, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17146546.11375, + "upper_bound": 19361370.053749993 + }, + "point_estimate": 18143510.0, + "standard_error": 573682.655997051 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 16740986.0, + "upper_bound": 17424599.0 + }, + "point_estimate": 16968194.666666664, + "standard_error": 229901.66677720705 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 195657.48302638714, + "upper_bound": 1252959.56955552 + }, + "point_estimate": 511778.6849141148, + "standard_error": 312813.7439799482 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 836295.1884200231, + "upper_bound": 3533793.8971270067 + }, + "point_estimate": 2637215.0702424864, + "standard_error": 644774.7183373219 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17247918.50958333, + "upper_bound": 17720801.310000002 + }, + "point_estimate": 17470157.266666662, + "standard_error": 121200.66484210106 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17128501.666666664, + "upper_bound": 17678456.166666664 + }, + "point_estimate": 17294379.833333336, + "standard_error": 131169.42632485536 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 159656.00206553936, + "upper_bound": 704874.4822859718 + }, + "point_estimate": 438813.51560950186, + "standard_error": 150194.36485942017 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 306978.1783183927, + "upper_bound": 717937.3518576053 + }, + "point_estimate": 558977.3748030334, + "standard_error": 105025.80782002538 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 16737197.46416667, + "upper_bound": 17016351.84583333 + }, + "point_estimate": 16863155.316666666, + "standard_error": 71780.81661671241 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 16683787.333333332, + "upper_bound": 16813002.333333332 + }, + "point_estimate": 16701207.666666668, + "standard_error": 38568.538101872495 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 19775.659748910475, + "upper_bound": 221314.86397087527 + }, + "point_estimate": 63737.21996843861, + "standard_error": 55375.83239667314 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 123240.23969321049, + "upper_bound": 441564.5100057192 + }, + "point_estimate": 328153.6856819335, + "standard_error": 78309.23790268657 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17037360.56916666, + "upper_bound": 17456992.05875 + }, + "point_estimate": 17238135.983333334, + "standard_error": 107204.27748980875 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 16855278.0, + "upper_bound": 17425518.5 + }, + "point_estimate": 17133785.166666664, + "standard_error": 146064.56103273248 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 186920.7684814953, + "upper_bound": 788770.3669965249 + }, + "point_estimate": 450552.0009011021, + "standard_error": 148577.9567493825 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 323387.22968011803, + "upper_bound": 604463.6789210287 + }, + "point_estimate": 491997.81922888826, + "standard_error": 71578.0252149046 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 19588096.09166666, + "upper_bound": 24154035.089166667 + }, + "point_estimate": 21600146.48333333, + "standard_error": 1174133.6903741283 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18223930.5, + "upper_bound": 22450187.666666664 + }, + "point_estimate": 20866367.5, + "standard_error": 1134092.449176831 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1646630.3869664725, + "upper_bound": 5831566.568168996 + }, + "point_estimate": 4088252.624619006, + "standard_error": 1070462.2013406921 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2416394.2522147167, + "upper_bound": 7920843.22162108 + }, + "point_estimate": 5379301.248767928, + "standard_error": 1600836.0552421736 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 16704024.995416665, + "upper_bound": 16929020.179166667 + }, + "point_estimate": 16812950.46666667, + "standard_error": 57344.44809446869 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 16600358.666666668, + "upper_bound": 16980388.666666664 + }, + "point_estimate": 16770224.166666668, + "standard_error": 93897.70265421092 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 110293.33014190012, + "upper_bound": 394872.9588896055 + }, + "point_estimate": 287989.11448717257, + "standard_error": 76466.92196624882 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 184325.6585040101, + "upper_bound": 323179.9288553253 + }, + "point_estimate": 262988.25588214875, + "standard_error": 35830.80043552265 + } + } + ] + }, + { + "benchmark": "jq/interleaved_filters", + "established_median_ns": 3352865.2053571427, + "experimental_median_ns": 3410622.9375, + "change_pct": 1.7226380604437486, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3392562.931003324, + "upper_bound": 3509626.5526104798 + }, + "point_estimate": 3447617.5170336575, + "standard_error": 29945.51964454905 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3348467.3167613633, + "upper_bound": 3524315.0 + }, + "point_estimate": 3374960.638888889, + "standard_error": 44901.79657036463 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14323.548543745419, + "upper_bound": 216437.89254079282 + }, + "point_estimate": 57229.01556398209, + "standard_error": 52985.31763078146 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3354385.1359949214, + "upper_bound": 3408696.750428407 + }, + "point_estimate": 3374087.930662021, + "standard_error": 13974.526818488586 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 82348.99987884359, + "upper_bound": 172681.20411590085 + }, + "point_estimate": 137753.73624542492, + "standard_error": 23135.842190701085 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3363644.2472862676, + "upper_bound": 3606691.1324742897 + }, + "point_estimate": 3470659.660505347, + "standard_error": 62991.88967225064 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3331550.8846153845, + "upper_bound": 3379284.6319444445 + }, + "point_estimate": 3352865.2053571427, + "standard_error": 19504.484903801604 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 21261.374188824826, + "upper_bound": 99336.91893212248 + }, + "point_estimate": 39169.441162937015, + "standard_error": 25352.76291858546 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3360340.4027745686, + "upper_bound": 3602951.745197369 + }, + "point_estimate": 3467115.169163763, + "standard_error": 63708.93407409885 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 93292.6659913763, + "upper_bound": 405365.9867471378 + }, + "point_estimate": 288248.6654411501, + "standard_error": 81776.7258103501 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3340680.5545447073, + "upper_bound": 3362121.4382503256 + }, + "point_estimate": 3351046.9321858613, + "standard_error": 5463.801654371598 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3336051.057748538, + "upper_bound": 3362266.8214285714 + }, + "point_estimate": 3346260.782352941, + "standard_error": 7794.500644580598 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13471.473144362822, + "upper_bound": 37694.384833732154 + }, + "point_estimate": 26390.2301114796, + "standard_error": 5869.862861440937 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3338235.8640064117, + "upper_bound": 3364967.053282562 + }, + "point_estimate": 3349529.3895470384, + "standard_error": 6894.390406550024 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17080.46267766523, + "upper_bound": 31279.295683995857 + }, + "point_estimate": 25021.33613718348, + "standard_error": 3693.1960517673847 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3466359.511572437, + "upper_bound": 3723888.5636637104 + }, + "point_estimate": 3566085.077926888, + "standard_error": 70648.54299248962 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3449950.0267857146, + "upper_bound": 3519436.409090909 + }, + "point_estimate": 3496649.8027777774, + "standard_error": 22875.56707005836 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 26302.845148820918, + "upper_bound": 154917.5260646641 + }, + "point_estimate": 69237.08665662876, + "standard_error": 29470.182905945945 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3484493.0657653986, + "upper_bound": 3618394.8974314956 + }, + "point_estimate": 3540651.5865853657, + "standard_error": 34218.41392850691 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 65049.72542336585, + "upper_bound": 523102.58340667863 + }, + "point_estimate": 324523.8120300958, + "standard_error": 151140.2344273646 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3401830.5628575566, + "upper_bound": 3664792.4770645476 + }, + "point_estimate": 3502768.7883312865, + "standard_error": 71783.3382012669 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3387054.9285714286, + "upper_bound": 3447577.708333333 + }, + "point_estimate": 3410622.9375, + "standard_error": 20459.687367906172 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 32268.02947712763, + "upper_bound": 97594.63368234855 + }, + "point_estimate": 54789.14226479817, + "standard_error": 17147.735292672478 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3410951.7387278993, + "upper_bound": 4015661.1032500505 + }, + "point_estimate": 3665859.5398954703, + "standard_error": 169879.7991536387 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 43600.570726851816, + "upper_bound": 524846.0432815596 + }, + "point_estimate": 329021.5358603686, + "standard_error": 152714.73223166712 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3380842.8219757145, + "upper_bound": 3416217.9990560035 + }, + "point_estimate": 3398081.880078229, + "standard_error": 9019.43749617759 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3380374.625, + "upper_bound": 3410877.0063025206 + }, + "point_estimate": 3397842.6346153845, + "standard_error": 8125.0178877472445 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 15544.160574035788, + "upper_bound": 58587.421314865416 + }, + "point_estimate": 35850.90646018584, + "standard_error": 12083.527299291158 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3387948.647796345, + "upper_bound": 3418656.575464523 + }, + "point_estimate": 3402511.9864111496, + "standard_error": 7858.173885592427 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 25112.224212970585, + "upper_bound": 53967.17444362103 + }, + "point_estimate": 41354.58873430602, + "standard_error": 7405.619611936027 + } + } + ] + }, + { + "benchmark": "jq/join_8192", + "established_median_ns": 60805971.5, + "experimental_median_ns": 60555851.0, + "change_pct": -0.4113420011717106, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60678120.44125, + "upper_bound": 61167251.9375 + }, + "point_estimate": 60919768.8, + "standard_error": 124724.85938682278 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60601188.0, + "upper_bound": 61183913.5 + }, + "point_estimate": 60805971.5, + "standard_error": 157259.31366674605 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 192835.1068764925, + "upper_bound": 871503.3991277218 + }, + "point_estimate": 458595.5999583006, + "standard_error": 166029.21743818387 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 385077.01381541707, + "upper_bound": 712020.198890754 + }, + "point_estimate": 573041.7909765763, + "standard_error": 83552.96408958318 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 61528824.4675, + "upper_bound": 64138295.5775 + }, + "point_estimate": 62549746.1, + "standard_error": 703380.0752514502 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 61191025.5, + "upper_bound": 62221557.5 + }, + "point_estimate": 61657793.5, + "standard_error": 328269.91106365353 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 423018.38968992233, + "upper_bound": 1679752.4116784334 + }, + "point_estimate": 835836.491560936, + "standard_error": 327236.6635670565 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 728032.8670421352, + "upper_bound": 5181781.496040905 + }, + "point_estimate": 3234625.394945366, + "standard_error": 1450868.2125142529 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60212910.635000005, + "upper_bound": 62630556.75625 + }, + "point_estimate": 61099940.25, + "standard_error": 697905.4762863276 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60092343.5, + "upper_bound": 60576849.0 + }, + "point_estimate": 60330150.5, + "standard_error": 142474.69774106066 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 247491.15490615368, + "upper_bound": 951944.0845996141 + }, + "point_estimate": 487655.3007423878, + "standard_error": 196665.31725478888 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 413932.9135146527, + "upper_bound": 5221916.524480951 + }, + "point_estimate": 3194178.688504628, + "standard_error": 1663843.801203715 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60373915.2475, + "upper_bound": 64573031.22625 + }, + "point_estimate": 61936000.75, + "standard_error": 1192825.1450261674 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60295494.0, + "upper_bound": 60892160.0 + }, + "point_estimate": 60555851.0, + "standard_error": 166385.13765283691 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 245891.42953455448, + "upper_bound": 1556311.137869954 + }, + "point_estimate": 859685.5947375298, + "standard_error": 384836.1417586896 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 631595.9434086633, + "upper_bound": 8903721.113740126 + }, + "point_estimate": 5475365.316512274, + "standard_error": 2774299.4810480676 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60749031.57, + "upper_bound": 66870190.293749996 + }, + "point_estimate": 62948067.9, + "standard_error": 1814216.442406127 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 60343435.0, + "upper_bound": 61502679.5 + }, + "point_estimate": 60827767.0, + "standard_error": 336837.9043841225 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 276315.12229442596, + "upper_bound": 1795942.2890156507 + }, + "point_estimate": 848586.8513345718, + "standard_error": 393949.735896734 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 797362.7397241603, + "upper_bound": 13648594.246193584 + }, + "point_estimate": 8324882.122597583, + "standard_error": 4523246.113356616 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 59883690.167500004, + "upper_bound": 60440745.1325 + }, + "point_estimate": 60159470.35, + "standard_error": 142585.96109331766 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 59721671.0, + "upper_bound": 60621311.5 + }, + "point_estimate": 60005279.5, + "standard_error": 245986.5391858665 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 320919.88380253315, + "upper_bound": 1026600.4062741995 + }, + "point_estimate": 780107.0411503315, + "standard_error": 186036.35251236233 + }, + "slope": null, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 484647.29200370243, + "upper_bound": 769886.7722774659 + }, + "point_estimate": 654356.5177638478, + "standard_error": 72658.80328027616 + } + } + ] + }, + { + "benchmark": "jq/json_round_trip", + "established_median_ns": 2572209.4291666667, + "experimental_median_ns": 2578684.5372807016, + "change_pct": 0.2517333169147262, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2555000.505286765, + "upper_bound": 2586521.2104504057 + }, + "point_estimate": 2570834.226840072, + "standard_error": 8059.120827133541 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2554909.8529411764, + "upper_bound": 2594422.4976190478 + }, + "point_estimate": 2572209.4291666667, + "standard_error": 8576.395973595445 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14501.157721964873, + "upper_bound": 63101.03014223347 + }, + "point_estimate": 37489.54802192759, + "standard_error": 12211.334831814802 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2568086.783559211, + "upper_bound": 2593525.5215704385 + }, + "point_estimate": 2579762.5536585366, + "standard_error": 6488.669750404164 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 26300.845695502496, + "upper_bound": 44585.46411747207 + }, + "point_estimate": 37055.41496902883, + "standard_error": 4670.102806380396 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2589887.026572644, + "upper_bound": 2693944.1629755604 + }, + "point_estimate": 2634175.1233391217, + "standard_error": 27203.031628367513 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2580062.761029412, + "upper_bound": 2634298.7333333334 + }, + "point_estimate": 2608393.2403846155, + "standard_error": 13166.196972400598 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 24544.980889239498, + "upper_bound": 81751.82649762786 + }, + "point_estimate": 46923.17410224109, + "standard_error": 15068.902635748713 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2603499.4093096713, + "upper_bound": 2782567.787558802 + }, + "point_estimate": 2671559.555574913, + "standard_error": 50013.54082523966 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 37974.46450166963, + "upper_bound": 189901.6125531455 + }, + "point_estimate": 124998.75684886292, + "standard_error": 44452.14862833301 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2554480.368453204, + "upper_bound": 2587973.098165897 + }, + "point_estimate": 2570192.517484715, + "standard_error": 8568.063113997823 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2553636.0695488723, + "upper_bound": 2582196.260416667 + }, + "point_estimate": 2562656.0147058824, + "standard_error": 7537.236501643087 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11723.655614780047, + "upper_bound": 53050.858841099966 + }, + "point_estimate": 28970.367776482017, + "standard_error": 11426.493159316675 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2559647.5740586366, + "upper_bound": 2586590.79142575 + }, + "point_estimate": 2570733.408013937, + "standard_error": 6922.131110969446 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 22109.859384568048, + "upper_bound": 54276.8647993264 + }, + "point_estimate": 39307.67852854864, + "standard_error": 8752.7610911505 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2585297.466270514, + "upper_bound": 2933962.593485443 + }, + "point_estimate": 2720479.79115825, + "standard_error": 94583.3511313954 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2556742.216666667, + "upper_bound": 2640868.3928571427 + }, + "point_estimate": 2578684.5372807016, + "standard_error": 21791.611879424978 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 28010.69887744693, + "upper_bound": 149491.58153775852 + }, + "point_estimate": 79167.13209450245, + "standard_error": 29204.103720559935 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2593701.18655551, + "upper_bound": 2989415.512787675 + }, + "point_estimate": 2740450.7841463415, + "standard_error": 104509.03834208133 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 66397.30402912777, + "upper_bound": 693852.2630628787 + }, + "point_estimate": 434499.55849383626, + "standard_error": 197480.05953961448 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2565684.4376811287, + "upper_bound": 2841616.021795875 + }, + "point_estimate": 2669688.6017348757, + "standard_error": 76645.84666512013 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2555672.2041666666, + "upper_bound": 2597821.1 + }, + "point_estimate": 2569865.125, + "standard_error": 9902.810163475373 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13497.216862876314, + "upper_bound": 73667.91518950132 + }, + "point_estimate": 38202.52417176962, + "standard_error": 15536.573200336825 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2577640.609196794, + "upper_bound": 2678550.9827928087 + }, + "point_estimate": 2615777.9459930314, + "standard_error": 25974.31397126492 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 33729.84055079021, + "upper_bound": 564296.2418874432 + }, + "point_estimate": 351261.8083186575, + "standard_error": 170507.26136195875 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2573460.1948565845, + "upper_bound": 2636868.373666811 + }, + "point_estimate": 2602462.932750634, + "standard_error": 16276.88679187423 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2560156.736842105, + "upper_bound": 2600339.5625 + }, + "point_estimate": 2579104.958333333, + "standard_error": 11639.49284148829 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 13822.636967099237, + "upper_bound": 77563.80318130064 + }, + "point_estimate": 32457.741190916284, + "standard_error": 15954.730792767146 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2571856.328839649, + "upper_bound": 2680214.6113078087 + }, + "point_estimate": 2619420.168641115, + "standard_error": 29101.0578415469 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 35143.70170516592, + "upper_bound": 98658.50259837732 + }, + "point_estimate": 74350.52331054687, + "standard_error": 16059.293825778315 + } + } + ] + }, + { + "benchmark": "jq/object_copy_on_write", + "established_median_ns": 8026963.291666666, + "experimental_median_ns": 7821756.927884616, + "change_pct": -2.5564632143651234, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8025882.463663524, + "upper_bound": 8137520.521662635 + }, + "point_estimate": 8078508.424815355, + "standard_error": 28661.024874360814 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7988054.376984127, + "upper_bound": 8093566.2 + }, + "point_estimate": 8026963.291666666, + "standard_error": 29912.251839725068 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 39279.79778597737, + "upper_bound": 180895.61397512752 + }, + "point_estimate": 80924.17779664183, + "standard_error": 33975.30113732061 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8028088.2092693355, + "upper_bound": 8141989.43302069 + }, + "point_estimate": 8078327.668989547, + "standard_error": 29069.3437083886 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 77357.10883854254, + "upper_bound": 161017.94156254033 + }, + "point_estimate": 131543.6322039153, + "standard_error": 21322.210865262823 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8111933.347414457, + "upper_bound": 8285853.619167162 + }, + "point_estimate": 8188435.612810197, + "standard_error": 44869.3955665486 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8090090.253846154, + "upper_bound": 8175719.75 + }, + "point_estimate": 8113893.277941177, + "standard_error": 21890.557093496995 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 26920.08092976512, + "upper_bound": 163797.16854201976 + }, + "point_estimate": 65417.66491419305, + "standard_error": 37293.81493476947 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8100763.481404526, + "upper_bound": 8338308.373711375 + }, + "point_estimate": 8196872.106620209, + "standard_error": 62389.45757268454 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 73669.98898526764, + "upper_bound": 293070.7798956007 + }, + "point_estimate": 206278.17624373763, + "standard_error": 58620.149220787025 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7992174.23193956, + "upper_bound": 8066806.258211733 + }, + "point_estimate": 8027829.422207817, + "standard_error": 19154.22676493028 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7984889.648692811, + "upper_bound": 8044087.503787879 + }, + "point_estimate": 8006403.201923077, + "standard_error": 15951.727974188301 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 24869.607117438078, + "upper_bound": 132673.2414612463 + }, + "point_estimate": 55870.7449528513, + "standard_error": 24835.400518550876 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 8002115.289766501, + "upper_bound": 8092158.068506034 + }, + "point_estimate": 8042748.9651567945, + "standard_error": 23152.68482950711 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 53780.098315953896, + "upper_bound": 109818.89316180989 + }, + "point_estimate": 88318.74089818036, + "standard_error": 14257.661464977833 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7849643.335584135, + "upper_bound": 8553088.982539514 + }, + "point_estimate": 8103693.693584412, + "standard_error": 207532.7440525111 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7819708.419298246, + "upper_bound": 7985958.422222222 + }, + "point_estimate": 7900339.386904762, + "standard_error": 39759.038873035264 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 77704.31547343919, + "upper_bound": 216279.4190769391 + }, + "point_estimate": 164111.16556644457, + "standard_error": 38114.7024199779 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7812981.1093791695, + "upper_bound": 9092467.509140827 + }, + "point_estimate": 8220229.545296167, + "standard_error": 371976.7745507504 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 101128.79186772347, + "upper_bound": 1563895.3541871111 + }, + "point_estimate": 953398.928638604, + "standard_error": 515949.46974644746 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7705818.078950235, + "upper_bound": 8190099.195513985 + }, + "point_estimate": 7906132.5490194885, + "standard_error": 126696.60791139104 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7669988.547368421, + "upper_bound": 7791605.17948718 + }, + "point_estimate": 7725242.954248367, + "standard_error": 35139.21309186738 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 43633.3514927655, + "upper_bound": 152518.1312306367 + }, + "point_estimate": 99033.56856043139, + "standard_error": 27999.834544055007 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7707005.870384818, + "upper_bound": 8263959.964843235 + }, + "point_estimate": 7896485.968292683, + "standard_error": 156691.1619532838 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 69027.25798560567, + "upper_bound": 840443.106437725 + }, + "point_estimate": 580782.6976922569, + "standard_error": 210302.22261598273 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7820058.354013655, + "upper_bound": 8182570.446409125 + }, + "point_estimate": 7983029.1217263285, + "standard_error": 93052.72593154729 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7752235.333333333, + "upper_bound": 7992501.692857143 + }, + "point_estimate": 7821756.927884616, + "standard_error": 70564.54943038756 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 75163.46705602414, + "upper_bound": 479724.6510931844 + }, + "point_estimate": 204612.5845474002, + "standard_error": 97845.83860961712 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7947327.208957837, + "upper_bound": 8598180.430324152 + }, + "point_estimate": 8268351.980836237, + "standard_error": 169442.91613398909 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 207593.60279121564, + "upper_bound": 598639.5044250257 + }, + "point_estimate": 426109.34093258413, + "standard_error": 108977.02041140632 + } + } + ] + }, + { + "benchmark": "jq/object_merge", + "established_median_ns": 2740318.6875, + "experimental_median_ns": 2752490.5714285714, + "change_pct": 0.44417767846103295, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2676112.4074904146, + "upper_bound": 2705592.1726256716 + }, + "point_estimate": 2689823.248086133, + "standard_error": 7560.496443587156 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2670629.466666667, + "upper_bound": 2708586.004385965 + }, + "point_estimate": 2684940.3647058825, + "standard_error": 8977.495420470565 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10624.688238874054, + "upper_bound": 44099.42021413799 + }, + "point_estimate": 35057.02476730363, + "standard_error": 8364.578320296707 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2685788.655336997, + "upper_bound": 2710465.7835509162 + }, + "point_estimate": 2696885.323170732, + "standard_error": 6245.741824715634 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 19732.169876103442, + "upper_bound": 48748.83644923369 + }, + "point_estimate": 34621.21815781574, + "standard_error": 8179.214820659561 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2734288.1900741654, + "upper_bound": 2765472.793917943 + }, + "point_estimate": 2749261.9453497473, + "standard_error": 7956.925330439325 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2721461.823529412, + "upper_bound": 2769601.8968253965 + }, + "point_estimate": 2740318.6875, + "standard_error": 13238.004067547332 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 15855.389247922229, + "upper_bound": 55873.70478699066 + }, + "point_estimate": 40608.49510383572, + "standard_error": 10377.13327644725 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2731387.60782792, + "upper_bound": 2770647.4276234927 + }, + "point_estimate": 2751472.3613240416, + "standard_error": 10083.65215127564 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 24640.936784716465, + "upper_bound": 44629.97378616175 + }, + "point_estimate": 36289.60728297786, + "standard_error": 5136.054678592067 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2746540.101666531, + "upper_bound": 2804868.7780621015 + }, + "point_estimate": 2773146.023652353, + "standard_error": 14963.218357713657 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2730955.675, + "upper_bound": 2777528.8125 + }, + "point_estimate": 2751975.50625, + "standard_error": 11645.991894460425 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 17734.879417642882, + "upper_bound": 79134.15850085692 + }, + "point_estimate": 47414.45612191105, + "standard_error": 15555.918376820511 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2735988.041753904, + "upper_bound": 2838211.1264118096 + }, + "point_estimate": 2782588.162020906, + "standard_error": 26694.757016105872 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 35327.71238866491, + "upper_bound": 91959.18522549799 + }, + "point_estimate": 68664.12219336725, + "standard_error": 14882.712954541283 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2751381.7721008332, + "upper_bound": 2809049.122127118 + }, + "point_estimate": 2777041.6454714863, + "standard_error": 14820.36775249009 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2736839.314593301, + "upper_bound": 2786306.95 + }, + "point_estimate": 2752490.5714285714, + "standard_error": 14899.2369171881 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14737.91313062911, + "upper_bound": 75232.01239321084 + }, + "point_estimate": 40168.732060391725, + "standard_error": 16465.02492441174 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2746374.563011137, + "upper_bound": 2798218.043449282 + }, + "point_estimate": 2769963.3324041814, + "standard_error": 13529.710737264602 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 32793.71117497843, + "upper_bound": 98274.0605336601 + }, + "point_estimate": 68127.1788063253, + "standard_error": 18772.802941431826 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2671842.6652729153, + "upper_bound": 2838575.9828017927 + }, + "point_estimate": 2732076.539384298, + "standard_error": 49072.928988012914 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2662513.6904761903, + "upper_bound": 2695086.239583333 + }, + "point_estimate": 2685805.725, + "standard_error": 7850.263927140468 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10313.472880354922, + "upper_bound": 57529.286669026034 + }, + "point_estimate": 34532.76977192119, + "standard_error": 11897.315689517847 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2683021.1065865527, + "upper_bound": 2758659.7798176655 + }, + "point_estimate": 2710650.0966898953, + "standard_error": 19840.75849306414 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 23460.206421105613, + "upper_bound": 370810.48280408647 + }, + "point_estimate": 226232.41040756713, + "standard_error": 122148.69753271286 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2739733.2239178647, + "upper_bound": 2785365.066039166 + }, + "point_estimate": 2762383.7832856267, + "standard_error": 11677.854757055607 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2725888.315384615, + "upper_bound": 2792512.916666667 + }, + "point_estimate": 2763903.2410714286, + "standard_error": 16637.949804330343 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30054.15627160674, + "upper_bound": 89560.8992099762 + }, + "point_estimate": 62464.89385435993, + "standard_error": 15721.950019421578 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2721623.893491999, + "upper_bound": 2769433.083928897 + }, + "point_estimate": 2744462.144773519, + "standard_error": 12217.628927959231 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 39320.095519888426, + "upper_bound": 63495.83776383333 + }, + "point_estimate": 53519.87206234978, + "standard_error": 6194.33727367489 + } + } + ] + }, + { + "benchmark": "jq/object_updates_4096", + "established_median_ns": 6566896.46875, + "experimental_median_ns": 6455796.133333333, + "change_pct": -1.6918240746654378, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6518266.216766377, + "upper_bound": 6644238.384877144 + }, + "point_estimate": 6572314.280536557, + "standard_error": 32593.48444087972 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6502765.884615384, + "upper_bound": 6580719.328571429 + }, + "point_estimate": 6525561.35, + "standard_error": 20332.297429361293 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 25544.47804943612, + "upper_bound": 123848.17337125567 + }, + "point_estimate": 65725.84222404218, + "standard_error": 24975.5027965829 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6515437.885577837, + "upper_bound": 6626883.097007438 + }, + "point_estimate": 6565067.416027875, + "standard_error": 28363.97754249349 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 56556.48554435062, + "upper_bound": 225144.27972569273 + }, + "point_estimate": 149325.10307993714, + "standard_error": 49275.42918560154 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7221808.064269408, + "upper_bound": 8058098.854680724 + }, + "point_estimate": 7583757.159401404, + "standard_error": 216287.66428399977 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6990093.401515152, + "upper_bound": 7731361.725 + }, + "point_estimate": 7335851.40625, + "standard_error": 200119.4681112195 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 262405.17615410476, + "upper_bound": 954199.4839262398 + }, + "point_estimate": 665803.1792396308, + "standard_error": 175730.31595464385 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7219793.441429104, + "upper_bound": 8259047.17500586 + }, + "point_estimate": 7646959.81184669, + "standard_error": 267158.43063699984 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 386097.663636857, + "upper_bound": 1473635.5641012115 + }, + "point_estimate": 993502.9218372894, + "standard_error": 314729.3780498524 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6532724.986027748, + "upper_bound": 6620546.833794418 + }, + "point_estimate": 6575006.274703195, + "standard_error": 22328.598555755045 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6503952.856617647, + "upper_bound": 6615304.116666667 + }, + "point_estimate": 6566896.46875, + "standard_error": 26814.8047104787 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 47815.82595109894, + "upper_bound": 145084.58592423343 + }, + "point_estimate": 111511.41476145257, + "standard_error": 26990.607554696388 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6540910.328422404, + "upper_bound": 6593657.418512912 + }, + "point_estimate": 6567384.416376307, + "standard_error": 13378.023046026106 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 64910.189347960106, + "upper_bound": 128125.70572250962 + }, + "point_estimate": 102134.73338107932, + "standard_error": 16237.393797246055 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6554414.186099484, + "upper_bound": 6700415.694158433 + }, + "point_estimate": 6621658.325676607, + "standard_error": 37395.45592228503 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6528107.394736842, + "upper_bound": 6652493.75 + }, + "point_estimate": 6561317.54117647, + "standard_error": 34510.1373199411 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 39389.16012570262, + "upper_bound": 193480.630905032 + }, + "point_estimate": 116222.71692663418, + "standard_error": 40016.68769856465 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6565527.514328686, + "upper_bound": 6745368.663178999 + }, + "point_estimate": 6640769.177003484, + "standard_error": 46126.58148345875 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 84369.10655350682, + "upper_bound": 227518.4486775477 + }, + "point_estimate": 172228.61054195173, + "standard_error": 36883.79293251712 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6249387.125354583, + "upper_bound": 6529874.3828414725 + }, + "point_estimate": 6360682.29004873, + "standard_error": 73863.56560999568 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6229171.011904762, + "upper_bound": 6297502.961111112 + }, + "point_estimate": 6250456.300000001, + "standard_error": 17364.452048093135 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 22606.96326864612, + "upper_bound": 101308.94609474036 + }, + "point_estimate": 55199.81628000727, + "standard_error": 19703.48348318929 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6236396.025077017, + "upper_bound": 6549886.741949978 + }, + "point_estimate": 6341310.960627178, + "standard_error": 86579.56336311692 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 41548.910554802256, + "upper_bound": 521778.15458705573 + }, + "point_estimate": 338382.1771711641, + "standard_error": 139973.37821117 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6459070.975904343, + "upper_bound": 6656169.169549752 + }, + "point_estimate": 6549809.308609133, + "standard_error": 50531.322717109884 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6413867.6062091505, + "upper_bound": 6550835.483333333 + }, + "point_estimate": 6455796.133333333, + "standard_error": 39973.60556006589 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 63576.98288892978, + "upper_bound": 265035.0198496875 + }, + "point_estimate": 125523.06656151997, + "standard_error": 47337.682733162655 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6450743.59346865, + "upper_bound": 6674498.590345054 + }, + "point_estimate": 6544461.597909408, + "standard_error": 57792.165022665606 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 113985.59859496249, + "upper_bound": 300223.00978471775 + }, + "point_estimate": 232752.87380195316, + "standard_error": 47225.48869891988 + } + } + ] + }, + { + "benchmark": "jq/repeated_filter", + "established_median_ns": 1980767.5805860804, + "experimental_median_ns": 2051680.1666666665, + "change_pct": 3.5800558720576525, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1972371.4392180177, + "upper_bound": 2056126.2391977787 + }, + "point_estimate": 2006603.5280882693, + "standard_error": 21966.88489980896 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1955324.7642045454, + "upper_bound": 2009483.0250626565 + }, + "point_estimate": 1980767.5805860804, + "standard_error": 14147.929722433295 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14746.542674029806, + "upper_bound": 74243.54113191355 + }, + "point_estimate": 43559.39403970014, + "standard_error": 14623.911418787467 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1973221.965005459, + "upper_bound": 2027200.9567467694 + }, + "point_estimate": 1999329.7267131242, + "standard_error": 14153.25600187621 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 31755.809739230157, + "upper_bound": 157616.70090294277 + }, + "point_estimate": 100778.3972030107, + "standard_error": 39668.967408535405 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1992718.4255842406, + "upper_bound": 2115552.5815391783 + }, + "point_estimate": 2039001.4230800376, + "standard_error": 34367.00844916963 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1976712.6597222222, + "upper_bound": 2017392.3368055555 + }, + "point_estimate": 1995064.1305361306, + "standard_error": 11422.67971168425 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 11798.740842284877, + "upper_bound": 66125.21410488036 + }, + "point_estimate": 33347.77112082594, + "standard_error": 13449.180660594388 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1978201.929940731, + "upper_bound": 2005870.7599740317 + }, + "point_estimate": 1989289.3204413473, + "standard_error": 7111.594499985198 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 29047.63694234426, + "upper_bound": 255003.70566046546 + }, + "point_estimate": 157035.20111841522, + "standard_error": 77175.18436715733 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1952920.9420320531, + "upper_bound": 1976697.2420361338 + }, + "point_estimate": 1964482.2679480924, + "standard_error": 6073.996635809762 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1948713.3101851852, + "upper_bound": 1971921.9398148148 + }, + "point_estimate": 1965030.1427696077, + "standard_error": 6323.039087258829 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 9690.541119625266, + "upper_bound": 45578.24135749099 + }, + "point_estimate": 24191.33556018281, + "standard_error": 8700.888506801972 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 1956890.994549798, + "upper_bound": 1978655.5922124877 + }, + "point_estimate": 1966822.3113821137, + "standard_error": 5602.410337717077 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18488.967891436492, + "upper_bound": 34392.93917087797 + }, + "point_estimate": 28003.68113769681, + "standard_error": 4061.0804264105086 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2045155.6067327722, + "upper_bound": 2066802.4942663081 + }, + "point_estimate": 2055371.993549145, + "standard_error": 5528.746751134457 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2044277.5185185184, + "upper_bound": 2065662.487179487 + }, + "point_estimate": 2052289.707912458, + "standard_error": 5862.052059633224 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10204.15493384013, + "upper_bound": 35628.53293746714 + }, + "point_estimate": 20646.1740257647, + "standard_error": 6710.484191798055 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2046201.8475746359, + "upper_bound": 2079143.9916112942 + }, + "point_estimate": 2061285.6207897794, + "standard_error": 8458.203939935524 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14964.082728051308, + "upper_bound": 34611.77494159903 + }, + "point_estimate": 25322.783046202676, + "standard_error": 5356.286369002624 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2045307.7122215093, + "upper_bound": 2211252.34008125 + }, + "point_estimate": 2105209.9972261754, + "standard_error": 48886.34674066492 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2038452.5833333335, + "upper_bound": 2060052.4871794872 + }, + "point_estimate": 2051680.1666666665, + "standard_error": 5268.3444115442235 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7687.323630830284, + "upper_bound": 47669.03851743085 + }, + "point_estimate": 24538.7827976826, + "standard_error": 10526.950220252342 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2045712.350227745, + "upper_bound": 2448181.911648703 + }, + "point_estimate": 2191724.163182346, + "standard_error": 120769.40283999417 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18863.2871434293, + "upper_bound": 366008.72860410623 + }, + "point_estimate": 223548.21578232513, + "standard_error": 120169.0919329869 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2024594.0946761495, + "upper_bound": 2051012.7518727398 + }, + "point_estimate": 2037213.0940742362, + "standard_error": 6736.572625341752 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2021923.8958333335, + "upper_bound": 2048850.888888889 + }, + "point_estimate": 2027545.8024132731, + "standard_error": 7222.150259513002 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 5990.196074861801, + "upper_bound": 40005.90647157121 + }, + "point_estimate": 22918.245771038462, + "standard_error": 8953.938628089176 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2021515.3163522074, + "upper_bound": 2043654.4280881826 + }, + "point_estimate": 2030329.924738676, + "standard_error": 5670.772118468625 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18569.515439679657, + "upper_bound": 39153.66541734369 + }, + "point_estimate": 30958.560797284747, + "standard_error": 5201.454923413854 + } + } + ] + }, + { + "benchmark": "jq/single_lookup", + "established_median_ns": 500918.764957265, + "experimental_median_ns": 495535.9918300654, + "change_pct": -1.0745800524479932, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 498166.3770001415, + "upper_bound": 528006.0385629833 + }, + "point_estimate": 509622.89404116414, + "standard_error": 8072.515372162962 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 496561.62103174604, + "upper_bound": 503025.6388888889 + }, + "point_estimate": 500918.764957265, + "standard_error": 1938.5391423300057 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3047.2512659004683, + "upper_bound": 10057.086061209693 + }, + "point_estimate": 6459.901469288236, + "standard_error": 1728.2438181498987 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 496936.0575948309, + "upper_bound": 523940.50840542116 + }, + "point_estimate": 506072.1212543554, + "standard_error": 7304.124319682395 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4432.443896860048, + "upper_bound": 58621.90397372975 + }, + "point_estimate": 36983.52128980528, + "standard_error": 16833.16031698003 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 508847.4923015555, + "upper_bound": 680055.2069114313 + }, + "point_estimate": 569473.0267325011, + "standard_error": 51478.345325004855 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 506151.2925925926, + "upper_bound": 525491.955026455 + }, + "point_estimate": 508882.5462962963, + "standard_error": 6100.379288707505 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 5773.022052011244, + "upper_bound": 28880.67764478184 + }, + "point_estimate": 17589.41622615137, + "standard_error": 5679.049684090345 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 506625.42307085916, + "upper_bound": 794807.282809698 + }, + "point_estimate": 601882.0781649245, + "standard_error": 81561.36969374566 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 12614.84311334156, + "upper_bound": 386344.8470167325 + }, + "point_estimate": 235711.65866605195, + "standard_error": 130689.4499368835 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 494496.58884895133, + "upper_bound": 503693.45580935903 + }, + "point_estimate": 498616.81371943187, + "standard_error": 2367.718188277824 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 492618.3296296296, + "upper_bound": 499902.22067901236 + }, + "point_estimate": 496657.0906084656, + "standard_error": 1783.2172944232152 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2753.2101155652367, + "upper_bound": 9150.501144900207 + }, + "point_estimate": 5822.197552190875, + "standard_error": 1674.849799156619 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 492970.7817025647, + "upper_bound": 497528.4362030871 + }, + "point_estimate": 495261.88726287265, + "standard_error": 1164.2821054474066 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4102.1581944221825, + "upper_bound": 14935.050849373827 + }, + "point_estimate": 10866.469252257091, + "standard_error": 2873.254695997395 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 494130.804543474, + "upper_bound": 503248.27605316526 + }, + "point_estimate": 498401.33768637973, + "standard_error": 2329.446088914307 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 492147.41851851856, + "upper_bound": 501949.68518518517 + }, + "point_estimate": 495535.9918300654, + "standard_error": 2997.461408943124 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 4218.751952879931, + "upper_bound": 14685.979102466275 + }, + "point_estimate": 9447.141816040401, + "standard_error": 2760.2936580909777 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 495714.9392862304, + "upper_bound": 503637.3054529291 + }, + "point_estimate": 499332.21022067365, + "standard_error": 2021.2717318108373 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 6382.984471193268, + "upper_bound": 14236.067638874536 + }, + "point_estimate": 10685.459057715034, + "standard_error": 2100.420737548037 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 490375.80831097334, + "upper_bound": 541148.3232250966 + }, + "point_estimate": 508277.6044460816, + "standard_error": 15411.750688027216 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 488416.34876543214, + "upper_bound": 498217.04662698414 + }, + "point_estimate": 490279.65277777775, + "standard_error": 2539.530701933326 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2247.7739384273477, + "upper_bound": 12266.451047324947 + }, + "point_estimate": 6506.1243519932, + "standard_error": 2620.5491851934626 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 490214.0746606852, + "upper_bound": 610249.6251152271 + }, + "point_estimate": 532485.5884630275, + "standard_error": 35605.92288416364 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 5097.793043859656, + "upper_bound": 115986.57668074504 + }, + "point_estimate": 70662.53696668912, + "standard_error": 39705.47503878842 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 504406.39644152997, + "upper_bound": 530281.492136871 + }, + "point_estimate": 515477.5192992624, + "standard_error": 6686.4683230260225 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 501678.56172839506, + "upper_bound": 509925.7368055555 + }, + "point_estimate": 506538.0333333333, + "standard_error": 2170.896060271812 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 3258.463517150721, + "upper_bound": 18235.591425281298 + }, + "point_estimate": 7204.652473573328, + "standard_error": 3770.7388629785746 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 502657.62557427667, + "upper_bound": 548929.3470256494 + }, + "point_estimate": 521370.68393341074, + "standard_error": 12416.029260955085 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 7449.488270850324, + "upper_bound": 44623.69543653956 + }, + "point_estimate": 30643.690926626703, + "standard_error": 9965.11842716438 + } + } + ] + }, + { + "benchmark": "jq/sort_unique", + "established_median_ns": 2463591.011111111, + "experimental_median_ns": 2641856.2125, + "change_pct": 7.235990088650679, + "established_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2498897.9571350934, + "upper_bound": 2516473.3613049374 + }, + "point_estimate": 2507581.722655999, + "standard_error": 4510.947921726091 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2494851.2767857146, + "upper_bound": 2518777.6931372546 + }, + "point_estimate": 2504835.2083333335, + "standard_error": 7345.077496220616 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 12713.76102179676, + "upper_bound": 34362.91265071716 + }, + "point_estimate": 25868.830709363687, + "standard_error": 5971.789410990258 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2508263.8810189357, + "upper_bound": 2528269.038950688 + }, + "point_estimate": 2519296.516202091, + "standard_error": 5095.287024590789 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 15255.444993363455, + "upper_bound": 24214.168655175214 + }, + "point_estimate": 20616.291441531674, + "standard_error": 2291.7646437978183 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2452896.0357616795, + "upper_bound": 2496042.4682245282 + }, + "point_estimate": 2471408.3472220125, + "standard_error": 11112.38974330713 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2451916.41875, + "upper_bound": 2468085.9116161615 + }, + "point_estimate": 2458502.109375, + "standard_error": 5633.064877618156 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 9311.527275863802, + "upper_bound": 44468.918285518885 + }, + "point_estimate": 17300.36923831168, + "standard_error": 9685.937186803369 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2460397.0823038495, + "upper_bound": 2491010.6041118917 + }, + "point_estimate": 2474278.023867596, + "standard_error": 7866.49418441462 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 19836.38696644524, + "upper_bound": 77069.85186833389 + }, + "point_estimate": 50873.033258141906, + "standard_error": 17011.704269953498 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2460054.69253453, + "upper_bound": 2512135.4343058225 + }, + "point_estimate": 2481358.422820966, + "standard_error": 13738.702072274627 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2456084.958333333, + "upper_bound": 2483231.9436274506 + }, + "point_estimate": 2463591.011111111, + "standard_error": 7602.094185754213 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10664.241226296986, + "upper_bound": 43234.449949935144 + }, + "point_estimate": 27963.759613102768, + "standard_error": 8560.190627893078 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2464525.8628014154, + "upper_bound": 2568287.6164164287 + }, + "point_estimate": 2506916.2475609756, + "standard_error": 28754.298296147826 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 18793.807761610427, + "upper_bound": 99220.73502663616 + }, + "point_estimate": 63046.53411187424, + "standard_error": 25438.268343506996 + } + } + ], + "experimental_estimates": [ + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2658886.0912052146, + "upper_bound": 2697375.9903340125 + }, + "point_estimate": 2677211.369923608, + "standard_error": 9821.338132173449 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2648347.305555556, + "upper_bound": 2692629.5911764707 + }, + "point_estimate": 2682455.7894736845, + "standard_error": 14554.191231035455 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 10772.440032054363, + "upper_bound": 61005.86546391479 + }, + "point_estimate": 38947.67522597524, + "standard_error": 13819.266859529052 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2664057.890345456, + "upper_bound": 2711380.344911888 + }, + "point_estimate": 2685921.800174216, + "standard_error": 12091.397681934246 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 25914.16560338392, + "upper_bound": 58454.80655732944 + }, + "point_estimate": 45177.977240785876, + "standard_error": 8411.591124694456 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2658753.1867916975, + "upper_bound": 3059586.906560458 + }, + "point_estimate": 2825215.9034971674, + "standard_error": 104814.53777207427 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2616359.5505050505, + "upper_bound": 2704896.0285714287 + }, + "point_estimate": 2641856.2125, + "standard_error": 31752.553126248957 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 30608.25466563358, + "upper_bound": 186207.18605416187 + }, + "point_estimate": 75556.72934859988, + "standard_error": 43451.20536090034 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2684580.332626121, + "upper_bound": 3245681.823464057 + }, + "point_estimate": 2904850.895644599, + "standard_error": 149178.76194439476 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 105407.51306181752, + "upper_bound": 727915.1149418507 + }, + "point_estimate": 481472.96348152927, + "standard_error": 177805.5055689426 + } + }, + { + "mean": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2609316.877436254, + "upper_bound": 2681799.306494584 + }, + "point_estimate": 2642809.9447227116, + "standard_error": 18597.065937098756 + }, + "median": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2595494.6791666667, + "upper_bound": 2637195.676470588 + }, + "point_estimate": 2612095.907142857, + "standard_error": 10894.71169564222 + }, + "median_abs_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 14884.93744632751, + "upper_bound": 89941.42626456424 + }, + "point_estimate": 36338.35576285572, + "standard_error": 19735.178819764555 + }, + "slope": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 2601745.220051408, + "upper_bound": 2652673.0571316695 + }, + "point_estimate": 2621542.4651567945, + "standard_error": 13149.609346674504 + }, + "std_dev": { + "confidence_interval": { + "confidence_level": 0.95, + "lower_bound": 41687.519283505746, + "upper_bound": 110269.38017221395 + }, + "point_estimate": 85436.36917254167, + "standard_error": 17314.533428882678 + } + } + ] + } + ] +} diff --git a/crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md b/crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md new file mode 100644 index 000000000..81b49ae11 --- /dev/null +++ b/crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md @@ -0,0 +1,28 @@ +# Criterion jq Paired Backend Benchmark + +rustc 1.100.0 (0ef1bc386 2026-11-09); Linux x86_64; CPU affinity: 2. +3 alternating rounds, 20 samples, 0.3s warmup, 1.0s measurement target. +Bench profile overrides: `{}`. +Times are medians across round medians. Positive change means slower. Both backends assert identical output. + +| Benchmark | Before | After | Change | +|---|---:|---:|---:| +| `jq/aggregate_4096_rows` | 11.064 ms | 11.474 ms | +3.7% | +| `jq/array_concat` | 1.169 ms | 1.311 ms | +12.1% | +| `jq/array_copy_on_write` | 3.000 ms | 2.999 ms | -0.0% | +| `jq/array_updates_4096` | 3.438 ms | 3.437 ms | -0.0% | +| `jq/distinct_filters` | 31.127 ms | 30.703 ms | -1.4% | +| `jq/hot_and_unique_filters` | 16.968 ms | 17.134 ms | +1.0% | +| `jq/interleaved_filters` | 3.353 ms | 3.411 ms | +1.7% | +| `jq/join_8192` | 60.806 ms | 60.556 ms | -0.4% | +| `jq/json_round_trip` | 2.572 ms | 2.579 ms | +0.3% | +| `jq/object_copy_on_write` | 8.027 ms | 7.822 ms | -2.6% | +| `jq/object_merge` | 2.740 ms | 2.752 ms | +0.4% | +| `jq/object_updates_4096` | 6.567 ms | 6.456 ms | -1.7% | +| `jq/repeated_filter` | 1.981 ms | 2.052 ms | +3.6% | +| `jq/single_lookup` | 0.501 ms | 0.496 ms | -1.1% | +| `jq/sort_unique` | 2.464 ms | 2.642 ms | +7.2% | + +Before: `jq`; after: opt-in `experimental_jq`, both without default features. +All builds finish before measurement. The paired JSON retains every round's Criterion estimates. +Reproduce with `just bench-jq` (add `--quick` for thin-LTO development measurements). diff --git a/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs b/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs index c323f9645..c5e98dee0 100644 --- a/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs +++ b/crates/bashkit/fuzz/fuzz_targets/jq_lifecycle_fuzz.rs @@ -66,11 +66,18 @@ fuzz_target!(|data: &[u8]| { .max_live_intermediate_bytes( [16_384, 65_536, 1_048_576, 32_000_000][byte(4) % 4], ) - .timeout(std::time::Duration::from_millis(200)), + .timeout(std::time::Duration::from_secs(5)), ) .build(); let script = format!("jq -nc '{filter}'"); - bashkit::testing::fuzz_exec(&mut bash, &script, "jq_lifecycle_fuzz", &[]).await; + let result = bash + .exec_with_options( + &script, + bashkit::ExecOptions::new().timeout(std::time::Duration::from_millis(200)), + ) + .await + .unwrap_or_else(|error| bashkit::ExecResult::err(error.to_string(), 1)); + bashkit::testing::assert_fuzz_invariants(&result, &script, "jq_lifecycle_fuzz", &[]); // A fixed, non-fuzzed probe verifies that error/unwind cleanup lets the // next host request use the same interpreter and fresh meter normally. diff --git a/crates/bashkit/src/builtins/jq/owned/tests.rs b/crates/bashkit/src/builtins/jq/owned/tests.rs index 9feedc1b1..94488df7d 100644 --- a/crates/bashkit/src/builtins/jq/owned/tests.rs +++ b/crates/bashkit/src/builtins/jq/owned/tests.rs @@ -81,7 +81,32 @@ fn owning_iterator_keeps_storage_charged_until_drop() { retained, "partial consumption keeps capacity" ); + for _ in iter.by_ref() {} + assert_eq!( + meter::headroom(), + retained, + "exhaustion still keeps capacity" + ); + drop(iter); + assert_eq!(meter::headroom(), initial); + + let key = Val::utf8_str("key"); + let with_key = meter::headroom(); + let mut object = Container::::default(); + object.insert(key.clone(), Val::Null).unwrap(); + let retained = meter::headroom(); + let mut iter = object.into_iter(); + assert_eq!(meter::headroom(), retained); + assert!(iter.next().is_some()); + assert!(iter.next().is_none()); + assert_eq!( + meter::headroom(), + retained, + "object iterator keeps capacity" + ); drop(iter); + assert_eq!(meter::headroom(), with_key); + drop(key); assert_eq!(meter::headroom(), initial); } @@ -95,7 +120,7 @@ async fn synchronous_evaluation_observes_host_cancellation() { std::thread::sleep(std::time::Duration::from_millis(50)); token.store(true, std::sync::atomic::Ordering::Relaxed); }); - let start = std::time::Instant::now(); + let start = crate::time_compat::Instant::now(); let result = bash.exec("jq -n 'until(false; .)'").await; cancel.join().unwrap(); assert!(matches!(result, Err(crate::Error::Cancelled))); diff --git a/crates/bashkit/src/fs/realfs.rs b/crates/bashkit/src/fs/realfs.rs index 79b8716e0..5b84fc361 100644 --- a/crates/bashkit/src/fs/realfs.rs +++ b/crates/bashkit/src/fs/realfs.rs @@ -1305,6 +1305,13 @@ mod tests { let root = tempfile::tempdir().unwrap(); let outside = tempfile::tempdir().unwrap(); std::fs::write(outside.path().join("secret"), b"OUTSIDE").unwrap(); + // Give chmod a distinguishable initial mode even under a 077 umask. + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions( + outside.path().join("secret"), + std::fs::Permissions::from_mode(0o644), + ) + .unwrap(); std::fs::create_dir(root.path().join("a")).unwrap(); std::fs::write(root.path().join("a/secret"), b"inside").unwrap(); symlink(outside.path(), root.path().join("evil")).unwrap(); @@ -1349,7 +1356,6 @@ mod tests { stop.store(true, Ordering::Relaxed); racer.join().unwrap(); - use std::os::unix::fs::PermissionsExt; let outside_mode = std::fs::metadata(outside.path().join("secret")) .unwrap() .permissions() diff --git a/knowledge/operations/limitations.md b/knowledge/operations/limitations.md index 7fffeafd2..dad7c6945 100644 --- a/knowledge/operations/limitations.md +++ b/knowledge/operations/limitations.md @@ -207,6 +207,7 @@ pass in CI); only divergences and boundaries are recorded here. | L-JQ-002 | jq | Regex natives compile the pattern per filter invocation; mapping `test`/`match`/`split` over many inputs can repeat compilation because jaq's native callback has no per-run cache state | `regex_compat.rs::re_native` | | L-JQ-003 | jq | User-defined recursion is bounded by a 64 live-evaluator-context ceiling for host stack safety: non-tail recursive defs (`def s: if length==0 then 0 else .[0] + (.[1:]|s) end`) fail past ~62 levels with `jq: error: recursion limit (64) exceeded` (exit 5). Tail-recursive defs are unaffected and run to thousands of levels; unbounded recursion stops at the execution timeout | `jq_non_tail_recursion_is_bounded_on_a_two_mib_stack`, `jq_recursive_filters_stop_without_host_abort_or_hang`, `finite_user_recursion_stays_available` | | L-JQ-004 | jq | Input number literals are read as 64-bit floats, so jq 1.7's literal preservation is partial: `1.0` and `2.5` print as written, but `1.50` prints `1.5`, `1e2` prints `100.0`, `-0` prints `0` and integers past 2^64 lose digits. Computed numbers print like jq (`1024`, `1e+17`). Integer arithmetic stays exact where jq rounds to doubles | `input_number_literals_keep_their_form_until_computed` | +| L-JQ-005 | jq/yq | Opt-in `experimental_jq` owns container admission but retains jaq's language/evaluator. Conservative table growth, COW and comparison scratch admission can reject earlier near the memory ceiling than the established backend; release defaults leave the experiment disabled | `owned::tests`, [owned boundary](../runtimes/jaq-json-vendor.md#experimental-owned-boundary) | | L-FMT-001 | fmt | Line breaks come from the uutils Knuth-Plass breaker, not GNU's cost function, so a paragraph can wrap at different words than GNU `fmt` (same width limits, same paragraphs). `-t` indents continuation lines like uutils. GNU `fmt.c` is GPL and cannot be ported into MIT bashkit | `fmt.test.sh` cases marked `bash_diff` | | L-YQ-001 | yq | Expressions are Bashkit jq expressions; mikefarah/yq-only node, comment, style, anchor, tag, filename, and eval-all operators are not implemented | stance | | L-YQ-002 | yq | YAML conversion follows YAML 1.1, deterministically sorts mapping keys at the JSON-value boundary, drops comments/style/anchors, and rejects aliases, custom tags, non-string mapping keys, and non-finite numbers rather than expanding graphs or silently corrupting data | `yaml_aliases_are_rejected_before_expansion`, `yaml_tags_and_non_string_keys_fail_closed`, `yaml_duplicate_keys_and_lossy_numbers_fail_closed`, `inplace_update_is_atomic_and_suppresses_stdout` | diff --git a/knowledge/runtimes/jaq-json-vendor.md b/knowledge/runtimes/jaq-json-vendor.md index dcb502978..0a55ffb00 100644 --- a/knowledge/runtimes/jaq-json-vendor.md +++ b/knowledge/runtimes/jaq-json-vendor.md @@ -53,6 +53,15 @@ records about 9% overhead for array updates and 13% for object updates in an exploratory single pair. Keep the feature disabled by default; these results do not establish a speedup. +The [three-round release-profile comparison](../../crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md) +after tuning finds near parity on array updates/COW, about 2% faster object +updates, and about 3% faster object COW. Array concatenation is about 12% +slower and sort/unique about 7% slower. These are workload-specific medians; +the experiment is not a general performance win. Thin-LTO iteration against +the first owned implementation measured 6% faster array updates and 11% +faster object updates in alternating rounds; only same-profile comparisons +support that optimization claim. + `Val` selects `Container` instead of raw `Metered` bodies under the feature. Its private body and immutable `Deref` prohibit mutable entry handles, mutable child references and unchecked growth. Type-specific set, insert, diff --git a/site/src/data/performance-timeline.json b/site/src/data/performance-timeline.json index cb727ca9b..557995d79 100644 --- a/site/src/data/performance-timeline.json +++ b/site/src/data/performance-timeline.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-11-25T20:50:28.000Z", + "generatedAt": "2026-11-26T00:09:34.000Z", "sources": { "bench": "crates/bashkit-bench/results/*.json", "criterion": "crates/bashkit/benches/results/*.md", @@ -9,7 +9,7 @@ }, "summary": { "benchRuns": 17, - "criterionRuns": 29, + "criterionRuns": 30, "evalRuns": 58, "latestBench": { "id": "bench-454522b0b8c5-linux-x86_64-1795580000", @@ -3020,6 +3020,30 @@ "name": "`jq/interleaved_filters`", "changePct": -6.8 } + }, + { + "id": "criterion-jq-paired-linux-x86_64-1795651774", + "kind": "criterion", + "family": "jq", + "label": "Criterion jq Paired Backend Benchmark", + "date": "2026-11-26", + "timestamp": "2026-11-26T00:09:34.000Z", + "source": "crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md", + "reportSource": "crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md", + "cases": 15, + "medianUs": 3411, + "p95Us": 39658.9, + "medianChangePct": 0.3, + "meanChangePct": 1.5, + "bestChangePct": -2.6, + "fastestCase": { + "name": "`jq/single_lookup`", + "us": 496 + }, + "bestImprovement": { + "name": "`jq/object_copy_on_write`", + "changePct": -2.6 + } } ], "evalRuns": [ @@ -10889,6 +10913,15 @@ "detail": "6.8% faster in `jq/interleaved_filters`", "metric": 0, "source": "crates/bashkit/benches/results/criterion-jq-owned-cloud-linux-x86_64-1795639828.md" + }, + { + "date": "2026-11-26", + "timestamp": "2026-11-26T00:09:34.000Z", + "kind": "Criterion", + "title": "jq", + "detail": "2.6% faster in `jq/object_copy_on_write`", + "metric": 0.3, + "source": "crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md" } ] } From a8cac95b307975ee2b659fed24cffa03d6ef5269 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 18:59:06 -0600 Subject: [PATCH 08/12] bench(jq): record broad and parallel validation --- ...-1600ca61ae8a-linux-x86_64-1795653548.json | 4842 +++++++++++++++++ ...ch-1600ca61ae8a-linux-x86_64-1795653548.md | 308 ++ ...el-1600ca61ae8a-linux-x86_64-1795653579.md | 75 + site/src/data/performance-timeline.json | 262 +- 4 files changed, 5432 insertions(+), 55 deletions(-) create mode 100644 crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json create mode 100644 crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.md create mode 100644 crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md diff --git a/crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json b/crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json new file mode 100644 index 000000000..585948aef --- /dev/null +++ b/crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json @@ -0,0 +1,4842 @@ +{ + "moniker": "1600ca61ae8a-linux-x86_64", + "timestamp": "1795653547", + "system": { + "hostname": "1600ca61ae8a", + "os": "linux", + "arch": "x86_64", + "cpus": 4, + "moniker": "1600ca61ae8a-linux-x86_64" + }, + "iterations": 10, + "warmup": 2, + "prewarm_cases": 3, + "runners": [ + "bashkit", + "bash" + ], + "runner_versions": { + "bash": "/usr/bin/bash (GNU Bash 5.2.37(1)-release)" + }, + "results": [ + { + "runner": "bashkit", + "case_name": "startup_empty", + "category": "startup", + "iterations": 10, + "times_ns": [ + 78525, + 77598, + 74680, + 73593, + 71492, + 70814, + 69844, + 103449, + 76312, + 70953 + ], + "mean_ns": 76726.0, + "stddev_ns": 9355.87872944065, + "min_ns": 69844, + "max_ns": 103449, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "startup_empty", + "category": "startup", + "iterations": 10, + "times_ns": [ + 1593892, + 1566786, + 1518284, + 1583791, + 18156878, + 1825695, + 1936401, + 1638317, + 20182519, + 1793618 + ], + "mean_ns": 5179618.1, + "stddev_ns": 7010810.971462608, + "min_ns": 1518284, + "max_ns": 20182519, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "startup_true", + "category": "startup", + "iterations": 10, + "times_ns": [ + 98689, + 76871, + 72885, + 71933, + 71113, + 70225, + 70930, + 69711, + 70535, + 70017 + ], + "mean_ns": 74290.9, + "stddev_ns": 8370.992634687955, + "min_ns": 69711, + "max_ns": 98689, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "startup_true", + "category": "startup", + "iterations": 10, + "times_ns": [ + 1615660, + 1551535, + 1569039, + 1569964, + 1491461, + 1526935, + 1565224, + 1557069, + 1512285, + 1684055 + ], + "mean_ns": 1564322.7, + "stddev_ns": 51630.37209056313, + "min_ns": 1491461, + "max_ns": 1684055, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "startup_echo", + "category": "startup", + "iterations": 10, + "times_ns": [ + 79827, + 103628, + 78105, + 75832, + 74689, + 74935, + 74932, + 74368, + 75343, + 75244 + ], + "mean_ns": 78690.3, + "stddev_ns": 8471.685783242909, + "min_ns": 74368, + "max_ns": 103628, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "startup_echo", + "category": "startup", + "iterations": 10, + "times_ns": [ + 1468317, + 1542210, + 1660324, + 1465837, + 1571245, + 1604626, + 1742105, + 1518348, + 1479270, + 1612965 + ], + "mean_ns": 1566524.7, + "stddev_ns": 85770.50144898304, + "min_ns": 1465837, + "max_ns": 1742105, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "startup_exit", + "category": "startup", + "iterations": 10, + "times_ns": [ + 84492, + 80254, + 79193, + 77915, + 75936, + 75139, + 98042, + 78449, + 129718, + 81415 + ], + "mean_ns": 86055.3, + "stddev_ns": 15813.035774638594, + "min_ns": 75139, + "max_ns": 129718, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "startup_exit", + "category": "startup", + "iterations": 10, + "times_ns": [ + 1559219, + 1499424, + 1640145, + 1486132, + 1464215, + 1505332, + 1501475, + 1586695, + 1518653, + 1540402 + ], + "mean_ns": 1530169.2, + "stddev_ns": 50045.7880461483, + "min_ns": 1464215, + "max_ns": 1640145, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_assign_simple", + "category": "variables", + "iterations": 10, + "times_ns": [ + 87100, + 84557, + 120914, + 90977, + 83407, + 82497, + 81497, + 81247, + 81040, + 83934 + ], + "mean_ns": 87717.0, + "stddev_ns": 11438.102622375793, + "min_ns": 81040, + "max_ns": 120914, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_assign_simple", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1654100, + 1523822, + 1548334, + 1531711, + 1564100, + 1577152, + 1467470, + 1558687, + 1545767, + 1640199 + ], + "mean_ns": 1561134.2, + "stddev_ns": 51571.44609917392, + "min_ns": 1467470, + "max_ns": 1654100, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_assign_many", + "category": "variables", + "iterations": 10, + "times_ns": [ + 113364, + 112769, + 107952, + 106303, + 136924, + 105496, + 103419, + 103555, + 102264, + 101036 + ], + "mean_ns": 109308.2, + "stddev_ns": 10011.465764811865, + "min_ns": 101036, + "max_ns": 136924, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_assign_many", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1566240, + 1566734, + 1583477, + 1662590, + 7581672, + 1640559, + 1510468, + 1560835, + 1593365, + 1664096 + ], + "mean_ns": 2193003.6, + "stddev_ns": 1796820.8405572996, + "min_ns": 1510468, + "max_ns": 7581672, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_default", + "category": "variables", + "iterations": 10, + "times_ns": [ + 86465, + 83811, + 112609, + 83383, + 81628, + 80747, + 79889, + 81990, + 79843, + 79468 + ], + "mean_ns": 84983.3, + "stddev_ns": 9435.397257667533, + "min_ns": 79468, + "max_ns": 112609, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_default", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1571793, + 1549915, + 1697634, + 1569512, + 1478258, + 1535765, + 1455309, + 1487647, + 1520007, + 1732896 + ], + "mean_ns": 1559873.6, + "stddev_ns": 86157.37759959967, + "min_ns": 1455309, + "max_ns": 1732896, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_length", + "category": "variables", + "iterations": 10, + "times_ns": [ + 90744, + 87516, + 85396, + 83052, + 82403, + 83318, + 121396, + 83678, + 83758, + 83941 + ], + "mean_ns": 88520.2, + "stddev_ns": 11216.110331126381, + "min_ns": 82403, + "max_ns": 121396, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_length", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1595944, + 1512209, + 1611487, + 1527182, + 1658390, + 1634077, + 1503575, + 1578187, + 1514680, + 1657740 + ], + "mean_ns": 1579347.1, + "stddev_ns": 58181.03810426555, + "min_ns": 1503575, + "max_ns": 1658390, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_substring", + "category": "variables", + "iterations": 10, + "times_ns": [ + 94957, + 89785, + 87965, + 87312, + 84887, + 84259, + 83736, + 108458, + 85468, + 82539 + ], + "mean_ns": 88936.6, + "stddev_ns": 7347.920130213719, + "min_ns": 82539, + "max_ns": 108458, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_substring", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1657489, + 1726100, + 1630643, + 1742566, + 1633973, + 1618385, + 1709525, + 1517100, + 1598745, + 1760116 + ], + "mean_ns": 1659464.2, + "stddev_ns": 71490.81001751205, + "min_ns": 1517100, + "max_ns": 1760116, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_replace", + "category": "variables", + "iterations": 10, + "times_ns": [ + 98379, + 93027, + 89810, + 89152, + 88568, + 87560, + 86300, + 87152, + 86530, + 109747 + ], + "mean_ns": 91622.5, + "stddev_ns": 6968.434174906153, + "min_ns": 86300, + "max_ns": 109747, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_replace", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1575233, + 1788136, + 1558425, + 1590273, + 1607095, + 1610791, + 1758728, + 1554149, + 1589680, + 1550849 + ], + "mean_ns": 1618335.9, + "stddev_ns": 80284.24611522487, + "min_ns": 1550849, + "max_ns": 1788136, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_nested", + "category": "variables", + "iterations": 10, + "times_ns": [ + 95195, + 91717, + 134707, + 174245, + 113803, + 91813, + 88415, + 88405, + 86789, + 90395 + ], + "mean_ns": 105548.4, + "stddev_ns": 27006.919736245374, + "min_ns": 86789, + "max_ns": 174245, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_nested", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1534570, + 1562689, + 1558221, + 1512318, + 1614537, + 1599122, + 1607950, + 1668871, + 1580530, + 1688249 + ], + "mean_ns": 1592705.7, + "stddev_ns": 52687.972779468364, + "min_ns": 1512318, + "max_ns": 1688249, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "var_export", + "category": "variables", + "iterations": 10, + "times_ns": [ + 91675, + 88976, + 86348, + 85670, + 85474, + 117866, + 89435, + 85403, + 83443, + 88974 + ], + "mean_ns": 90326.4, + "stddev_ns": 9472.972217841663, + "min_ns": 83443, + "max_ns": 117866, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "var_export", + "category": "variables", + "iterations": 10, + "times_ns": [ + 1629670, + 1504936, + 1599985, + 1602774, + 1564784, + 1816719, + 1523630, + 1612306, + 1709610, + 1640752 + ], + "mean_ns": 1620516.6, + "stddev_ns": 85779.97627558545, + "min_ns": 1504936, + "max_ns": 1816719, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arith_basic", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 129424, + 86121, + 83082, + 81344, + 79789, + 77937, + 77012, + 77789, + 77025, + 76827 + ], + "mean_ns": 84635.0, + "stddev_ns": 15210.874189210823, + "min_ns": 76827, + "max_ns": 129424, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arith_basic", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 1521964, + 1570864, + 1627717, + 1979308, + 1674381, + 1828547, + 1594224, + 1549716, + 1751141, + 1799386 + ], + "mean_ns": 1689724.8, + "stddev_ns": 139284.745565909, + "min_ns": 1521964, + "max_ns": 1979308, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arith_complex", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 93830, + 87399, + 86413, + 84187, + 83746, + 84696, + 83396, + 118504, + 84185, + 80347 + ], + "mean_ns": 88670.3, + "stddev_ns": 10491.620542604463, + "min_ns": 80347, + "max_ns": 118504, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arith_complex", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 1619033, + 1510338, + 1634410, + 1872312, + 1536839, + 1666175, + 1608154, + 1571913, + 1487255, + 1574121 + ], + "mean_ns": 1608055.0, + "stddev_ns": 102808.33624954738, + "min_ns": 1487255, + "max_ns": 1872312, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arith_variables", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 126969, + 124538, + 94240, + 123192, + 97145, + 90292, + 88168, + 87498, + 86349, + 86298 + ], + "mean_ns": 100468.9, + "stddev_ns": 16343.424729535729, + "min_ns": 86298, + "max_ns": 126969, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arith_variables", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 1621981, + 1559991, + 1702962, + 1937081, + 1604654, + 1616602, + 1569691, + 1602771, + 1565329, + 1549506 + ], + "mean_ns": 1633056.8, + "stddev_ns": 109707.09206956495, + "min_ns": 1549506, + "max_ns": 1937081, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arith_increment", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 98169, + 94750, + 94365, + 139920, + 94864, + 91648, + 91035, + 90458, + 90859, + 89745 + ], + "mean_ns": 97581.3, + "stddev_ns": 14331.963871361106, + "min_ns": 89745, + "max_ns": 139920, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arith_increment", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 1875846, + 1585137, + 1593098, + 1751047, + 1818370, + 1510315, + 1673037, + 1554898, + 1561851, + 1555934 + ], + "mean_ns": 1647953.3, + "stddev_ns": 119446.29627749033, + "min_ns": 1510315, + "max_ns": 1875846, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arith_modulo", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 89934, + 83530, + 81179, + 80228, + 80136, + 78267, + 78819, + 78034, + 115752, + 79503 + ], + "mean_ns": 84538.2, + "stddev_ns": 10924.142545756165, + "min_ns": 78034, + "max_ns": 115752, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arith_modulo", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 1883312, + 1732019, + 1528409, + 1574033, + 1686662, + 1608151, + 1519355, + 1615941, + 1577294, + 1703684 + ], + "mean_ns": 1642886.0, + "stddev_ns": 105215.29306997154, + "min_ns": 1519355, + "max_ns": 1883312, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arith_loop_sum", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 240623, + 141172, + 134704, + 133787, + 139352, + 133103, + 163647, + 228193, + 141382, + 127522 + ], + "mean_ns": 158348.5, + "stddev_ns": 39203.47045160671, + "min_ns": 127522, + "max_ns": 240623, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arith_loop_sum", + "category": "arithmetic", + "iterations": 10, + "times_ns": [ + 1653791, + 1718554, + 2860206, + 1701863, + 1659567, + 1654190, + 1801661, + 1562690, + 1550631, + 1663980 + ], + "mean_ns": 1782713.3, + "stddev_ns": 365605.93170845846, + "min_ns": 1550631, + "max_ns": 2860206, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_if_simple", + "category": "control", + "iterations": 10, + "times_ns": [ + 91412, + 87930, + 86764, + 83349, + 110174, + 91343, + 148382, + 87078, + 83649, + 82551 + ], + "mean_ns": 95263.2, + "stddev_ns": 19249.89904804698, + "min_ns": 82551, + "max_ns": 148382, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_if_simple", + "category": "control", + "iterations": 10, + "times_ns": [ + 1612671, + 1641892, + 1626437, + 1510863, + 1489874, + 1594009, + 1619021, + 1665398, + 1594974, + 1507040 + ], + "mean_ns": 1586217.9, + "stddev_ns": 58420.456962351804, + "min_ns": 1489874, + "max_ns": 1665398, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_if_else", + "category": "control", + "iterations": 10, + "times_ns": [ + 89743, + 88924, + 86668, + 84939, + 120606, + 87649, + 84601, + 84933, + 84529, + 83780 + ], + "mean_ns": 89637.2, + "stddev_ns": 10499.151868603483, + "min_ns": 83780, + "max_ns": 120606, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_if_else", + "category": "control", + "iterations": 10, + "times_ns": [ + 1563084, + 1720364, + 1641340, + 1641068, + 1553514, + 1847951, + 1619829, + 1627425, + 1708443, + 1551790 + ], + "mean_ns": 1647480.8, + "stddev_ns": 86931.95666818964, + "min_ns": 1551790, + "max_ns": 1847951, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_for_list", + "category": "control", + "iterations": 10, + "times_ns": [ + 121660, + 115432, + 113135, + 113703, + 110934, + 156111, + 118384, + 110426, + 108984, + 108508 + ], + "mean_ns": 117727.7, + "stddev_ns": 13389.014579497627, + "min_ns": 108508, + "max_ns": 156111, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_for_list", + "category": "control", + "iterations": 10, + "times_ns": [ + 1535806, + 1610530, + 1605758, + 1505378, + 1584720, + 1681878, + 1589413, + 1657856, + 1600207, + 1641123 + ], + "mean_ns": 1601266.9, + "stddev_ns": 50289.370840069176, + "min_ns": 1505378, + "max_ns": 1681878, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_for_range", + "category": "control", + "iterations": 10, + "times_ns": [ + 157221, + 123358, + 120540, + 119308, + 117385, + 117404, + 116261, + 115895, + 138517, + 196326 + ], + "mean_ns": 132221.5, + "stddev_ns": 24732.054096859807, + "min_ns": 115895, + "max_ns": 196326, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_for_range", + "category": "control", + "iterations": 10, + "times_ns": [ + 1636792, + 1681579, + 1656906, + 1593418, + 1571685, + 1573822, + 1674727, + 1608499, + 1986191, + 2123731 + ], + "mean_ns": 1710735.0, + "stddev_ns": 178675.41271702718, + "min_ns": 1571685, + "max_ns": 2123731, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_while", + "category": "control", + "iterations": 10, + "times_ns": [ + 203597, + 168331, + 163753, + 164294, + 165469, + 183304, + 285035, + 174010, + 161883, + 159969 + ], + "mean_ns": 182964.5, + "stddev_ns": 36242.94298825635, + "min_ns": 159969, + "max_ns": 285035, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_while", + "category": "control", + "iterations": 10, + "times_ns": [ + 1672097, + 1629000, + 1658929, + 1867030, + 1744987, + 1601814, + 1651244, + 1753067, + 1664101, + 1912989 + ], + "mean_ns": 1715525.8, + "stddev_ns": 98237.23724006087, + "min_ns": 1601814, + "max_ns": 1912989, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_case", + "category": "control", + "iterations": 10, + "times_ns": [ + 100434, + 96586, + 94906, + 126302, + 169336, + 117128, + 94963, + 90913, + 90900, + 89386 + ], + "mean_ns": 107085.4, + "stddev_ns": 23731.45607500728, + "min_ns": 89386, + "max_ns": 169336, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_case", + "category": "control", + "iterations": 10, + "times_ns": [ + 1829797, + 1550909, + 1543172, + 1583921, + 1561005, + 1564320, + 1773658, + 1594746, + 1535466, + 1681305 + ], + "mean_ns": 1621829.9, + "stddev_ns": 98839.5751007156, + "min_ns": 1535466, + "max_ns": 1829797, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_function", + "category": "control", + "iterations": 10, + "times_ns": [ + 103108, + 100251, + 98340, + 96951, + 97590, + 95474, + 94128, + 121375, + 98272, + 96628 + ], + "mean_ns": 100211.7, + "stddev_ns": 7438.727378389398, + "min_ns": 94128, + "max_ns": 121375, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_function", + "category": "control", + "iterations": 10, + "times_ns": [ + 1637161, + 1640387, + 1965539, + 2049266, + 1658455, + 1687165, + 1629845, + 1631070, + 1597529, + 1526816 + ], + "mean_ns": 1702323.3, + "stddev_ns": 158746.01368541512, + "min_ns": 1526816, + "max_ns": 2049266, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_function_return", + "category": "control", + "iterations": 10, + "times_ns": [ + 133446, + 123609, + 120317, + 119471, + 118807, + 143629, + 127131, + 116614, + 113863, + 114625 + ], + "mean_ns": 123151.2, + "stddev_ns": 8851.677544962875, + "min_ns": 113863, + "max_ns": 143629, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_function_return", + "category": "control", + "iterations": 10, + "times_ns": [ + 2143638, + 2541054, + 2203500, + 2174126, + 2600586, + 2120560, + 1992937, + 2169285, + 2201775, + 2364995 + ], + "mean_ns": 2251245.6, + "stddev_ns": 182137.299717109, + "min_ns": 1992937, + "max_ns": 2600586, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "ctrl_nested_loops", + "category": "control", + "iterations": 10, + "times_ns": [ + 143865, + 139070, + 175299, + 142132, + 136768, + 136281, + 137061, + 136060, + 134001, + 156791 + ], + "mean_ns": 143732.8, + "stddev_ns": 12220.449171777607, + "min_ns": 134001, + "max_ns": 175299, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "ctrl_nested_loops", + "category": "control", + "iterations": 10, + "times_ns": [ + 1683819, + 1529541, + 1974946, + 1707895, + 1702763, + 1615458, + 1589297, + 1756861, + 1723144, + 1614880 + ], + "mean_ns": 1689860.4, + "stddev_ns": 115918.93076646283, + "min_ns": 1529541, + "max_ns": 1974946, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_concat", + "category": "strings", + "iterations": 10, + "times_ns": [ + 91829, + 90216, + 88027, + 87072, + 88043, + 136026, + 90191, + 85640, + 85032, + 84038 + ], + "mean_ns": 92611.4, + "stddev_ns": 14660.009496586283, + "min_ns": 84038, + "max_ns": 136026, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_concat", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1519322, + 1516382, + 1645592, + 1726183, + 1640888, + 1602584, + 1555063, + 1723144, + 1667723, + 1648058 + ], + "mean_ns": 1624493.9, + "stddev_ns": 71596.39557051737, + "min_ns": 1516382, + "max_ns": 1726183, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_printf", + "category": "strings", + "iterations": 10, + "times_ns": [ + 120419, + 89152, + 88355, + 85678, + 85890, + 84677, + 81433, + 80014, + 79293, + 78160 + ], + "mean_ns": 87307.1, + "stddev_ns": 11610.636644473894, + "min_ns": 78160, + "max_ns": 120419, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_printf", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1706119, + 1677659, + 1608986, + 1661388, + 1543594, + 1612128, + 1606371, + 1500535, + 1604166, + 1521609 + ], + "mean_ns": 1604255.5, + "stddev_ns": 63549.516050478305, + "min_ns": 1500535, + "max_ns": 1706119, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_printf_pad", + "category": "strings", + "iterations": 10, + "times_ns": [ + 86976, + 84829, + 80822, + 80758, + 80083, + 79538, + 77999, + 77573, + 103733, + 78400 + ], + "mean_ns": 83071.1, + "stddev_ns": 7448.808393964769, + "min_ns": 77573, + "max_ns": 103733, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_printf_pad", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1538359, + 1528022, + 1652772, + 1549035, + 1672438, + 1727344, + 1575898, + 1628460, + 1795387, + 1648054 + ], + "mean_ns": 1631576.9, + "stddev_ns": 82299.24501895506, + "min_ns": 1528022, + "max_ns": 1795387, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_echo_escape", + "category": "strings", + "iterations": 10, + "times_ns": [ + 85545, + 79393, + 79112, + 77988, + 76825, + 111874, + 148171, + 81032, + 77740, + 75974 + ], + "mean_ns": 89365.4, + "stddev_ns": 22033.02982433419, + "min_ns": 75974, + "max_ns": 148171, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_echo_escape", + "category": "strings", + "iterations": 10, + "times_ns": [ + 2109468, + 1927506, + 1604491, + 1725796, + 1564085, + 1595882, + 1846986, + 1630687, + 1554334, + 1560441 + ], + "mean_ns": 1711967.6, + "stddev_ns": 180054.4669288713, + "min_ns": 1554334, + "max_ns": 2109468, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_prefix_strip", + "category": "strings", + "iterations": 10, + "times_ns": [ + 92090, + 117464, + 88513, + 87992, + 85814, + 85592, + 84560, + 83864, + 83785, + 83304 + ], + "mean_ns": 89297.8, + "stddev_ns": 9734.534285727284, + "min_ns": 83304, + "max_ns": 117464, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_prefix_strip", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1917630, + 1951862, + 1648820, + 1762496, + 1640188, + 1545341, + 1568864, + 1664071, + 1605600, + 1632197 + ], + "mean_ns": 1693706.9, + "stddev_ns": 132822.97514169, + "min_ns": 1545341, + "max_ns": 1951862, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_suffix_strip", + "category": "strings", + "iterations": 10, + "times_ns": [ + 92472, + 88896, + 87538, + 85187, + 85073, + 85171, + 84009, + 109914, + 84142, + 83627 + ], + "mean_ns": 88602.9, + "stddev_ns": 7563.2167025677645, + "min_ns": 83627, + "max_ns": 109914, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_suffix_strip", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1650774, + 1721060, + 1673080, + 1616974, + 1542582, + 1555400, + 1634624, + 1616097, + 1635306, + 1689131 + ], + "mean_ns": 1633502.8, + "stddev_ns": 52509.73241181105, + "min_ns": 1542582, + "max_ns": 1721060, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_uppercase", + "category": "strings", + "iterations": 10, + "times_ns": [ + 95239, + 92030, + 89506, + 88187, + 86113, + 155209, + 94555, + 84353, + 103668, + 85532 + ], + "mean_ns": 97439.2, + "stddev_ns": 20021.034917306348, + "min_ns": 84353, + "max_ns": 155209, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_uppercase", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1793443, + 1672327, + 1678786, + 1645648, + 1621950, + 1630213, + 1663712, + 1612429, + 1739855, + 1669885 + ], + "mean_ns": 1672824.8, + "stddev_ns": 52876.75201031168, + "min_ns": 1612429, + "max_ns": 1793443, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "str_lowercase", + "category": "strings", + "iterations": 10, + "times_ns": [ + 91508, + 88124, + 87516, + 86693, + 84238, + 125896, + 91562, + 86104, + 84241, + 84020 + ], + "mean_ns": 90990.2, + "stddev_ns": 11922.09539300873, + "min_ns": 84020, + "max_ns": 125896, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "str_lowercase", + "category": "strings", + "iterations": 10, + "times_ns": [ + 1890627, + 1601285, + 1600015, + 1693604, + 1636672, + 1588977, + 1495229, + 1531638, + 1689898, + 1604437 + ], + "mean_ns": 1633238.2, + "stddev_ns": 103632.83214001247, + "min_ns": 1495229, + "max_ns": 1890627, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arr_create", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 104588, + 94958, + 93329, + 91675, + 91836, + 89763, + 89573, + 91976, + 91051, + 89391 + ], + "mean_ns": 92814.0, + "stddev_ns": 4255.383249485292, + "min_ns": 89391, + "max_ns": 104588, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arr_create", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 1631880, + 1587994, + 1598753, + 1690218, + 1656910, + 1685959, + 1521345, + 1579262, + 1579676, + 1533022 + ], + "mean_ns": 1606501.9, + "stddev_ns": 55697.45312211322, + "min_ns": 1521345, + "max_ns": 1690218, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arr_all", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 94007, + 91897, + 89890, + 87818, + 87464, + 87750, + 85525, + 180332, + 90888, + 87287 + ], + "mean_ns": 98285.8, + "stddev_ns": 27454.36508754118, + "min_ns": 85525, + "max_ns": 180332, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arr_all", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 1610490, + 1590817, + 1768489, + 1852296, + 3104494, + 1711462, + 1676947, + 1666125, + 1606779, + 1584560 + ], + "mean_ns": 1817245.9, + "stddev_ns": 436667.1558536204, + "min_ns": 1584560, + "max_ns": 3104494, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arr_length", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 110687, + 98981, + 98509, + 93983, + 89910, + 91929, + 89747, + 89031, + 87029, + 87528 + ], + "mean_ns": 93733.4, + "stddev_ns": 6907.710766961802, + "min_ns": 87029, + "max_ns": 110687, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arr_length", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 1598802, + 1625098, + 1534847, + 1584179, + 1601907, + 1654947, + 1641985, + 1497506, + 1596638, + 1563830 + ], + "mean_ns": 1589973.9, + "stddev_ns": 45531.831842020154, + "min_ns": 1497506, + "max_ns": 1654947, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arr_iterate", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 109499, + 105511, + 101170, + 101590, + 147987, + 102946, + 101637, + 98982, + 98215, + 97226 + ], + "mean_ns": 106476.3, + "stddev_ns": 14251.677038510239, + "min_ns": 97226, + "max_ns": 147987, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arr_iterate", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 1712654, + 1613516, + 1557542, + 1537619, + 1591540, + 1716080, + 1784651, + 1655832, + 1566238, + 1662191 + ], + "mean_ns": 1639786.3, + "stddev_ns": 76488.63665283883, + "min_ns": 1537619, + "max_ns": 1784651, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arr_slice", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 99624, + 94880, + 93774, + 92047, + 92635, + 119209, + 99212, + 197603, + 95811, + 91323 + ], + "mean_ns": 107611.8, + "stddev_ns": 30970.966367874284, + "min_ns": 91323, + "max_ns": 197603, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arr_slice", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 1629985, + 1607879, + 1673224, + 1634056, + 1736354, + 1738401, + 2326441, + 1680863, + 1765098, + 1704507 + ], + "mean_ns": 1749680.8, + "stddev_ns": 198398.8380287546, + "min_ns": 1607879, + "max_ns": 2326441, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "arr_assign_index", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 99779, + 95197, + 94256, + 95273, + 93884, + 131369, + 223080, + 98958, + 91543, + 89922 + ], + "mean_ns": 111326.1, + "stddev_ns": 38910.06170246971, + "min_ns": 89922, + "max_ns": 223080, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "arr_assign_index", + "category": "arrays", + "iterations": 10, + "times_ns": [ + 1680071, + 1640538, + 1605635, + 1639977, + 1639679, + 1574871, + 1773661, + 1957415, + 1895222, + 1731319 + ], + "mean_ns": 1713838.8, + "stddev_ns": 120250.61673754526, + "min_ns": 1574871, + "max_ns": 1957415, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "pipe_simple", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 117751, + 152172, + 110095, + 107805, + 105392, + 105879, + 102999, + 106547, + 102538, + 102971 + ], + "mean_ns": 111414.9, + "stddev_ns": 14239.399618312564, + "min_ns": 102538, + "max_ns": 152172, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "pipe_simple", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 3197027, + 3248122, + 3301929, + 3197393, + 3087874, + 3069000, + 3669710, + 3009551, + 3216943, + 3217456 + ], + "mean_ns": 3221500.5, + "stddev_ns": 171849.204496995, + "min_ns": 3009551, + "max_ns": 3669710, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "pipe_multi", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 212434, + 207200, + 242626, + 381774, + 217004, + 203726, + 255709, + 207262, + 276934, + 220484 + ], + "mean_ns": 242515.3, + "stddev_ns": 51756.529052961036, + "min_ns": 203726, + "max_ns": 381774, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "pipe_multi", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 4218284, + 3817979, + 3613351, + 3139919, + 3420478, + 5520445, + 6275616, + 5119667, + 3787288, + 4356933 + ], + "mean_ns": 4326996.0, + "stddev_ns": 956717.3648986414, + "min_ns": 3139919, + "max_ns": 6275616, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "pipe_command_subst", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 117153, + 189191, + 102079, + 96890, + 96898, + 98038, + 99351, + 488429, + 110015, + 98090 + ], + "mean_ns": 149613.4, + "stddev_ns": 116035.89489912162, + "min_ns": 96890, + "max_ns": 488429, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "pipe_command_subst", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 2329798, + 2186492, + 2293875, + 2208095, + 2275316, + 2183990, + 2241874, + 2183419, + 1996207, + 2307494 + ], + "mean_ns": 2220656.0, + "stddev_ns": 90931.3237756935, + "min_ns": 1996207, + "max_ns": 2329798, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "pipe_heredoc", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 102552, + 99071, + 96074, + 133940, + 110134, + 100334, + 92468, + 91688, + 93243, + 91823 + ], + "mean_ns": 101132.7, + "stddev_ns": 12259.82457500922, + "min_ns": 91688, + "max_ns": 133940, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "pipe_heredoc", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 2871273, + 5862319, + 6418017, + 2979796, + 2946219, + 2842863, + 2966669, + 3020011, + 2975737, + 2803580 + ], + "mean_ns": 3568648.4, + "stddev_ns": 1293342.353050823, + "min_ns": 2803580, + "max_ns": 6418017, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "pipe_herestring", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 98376, + 97812, + 93691, + 91367, + 89498, + 90312, + 119234, + 92473, + 88604, + 88100 + ], + "mean_ns": 94946.7, + "stddev_ns": 8767.14965139754, + "min_ns": 88100, + "max_ns": 119234, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "pipe_herestring", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 2758644, + 2825117, + 2986453, + 2933550, + 2830347, + 2931136, + 2979116, + 2920503, + 3034428, + 3051024 + ], + "mean_ns": 2925031.8, + "stddev_ns": 90167.97499755664, + "min_ns": 2758644, + "max_ns": 3051024, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "pipe_discard", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 105136, + 97893, + 97082, + 94241, + 92628, + 92803, + 92194, + 93772, + 114681, + 96813 + ], + "mean_ns": 97724.3, + "stddev_ns": 6725.059019071878, + "min_ns": 92194, + "max_ns": 114681, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "pipe_discard", + "category": "pipes", + "iterations": 10, + "times_ns": [ + 2136035, + 2059282, + 2154737, + 2153046, + 2268955, + 2103874, + 2070457, + 2081448, + 2093524, + 2111485 + ], + "mean_ns": 2123284.3, + "stddev_ns": 57703.13425118258, + "min_ns": 2059282, + "max_ns": 2268955, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_grep_simple", + "category": "tools", + "iterations": 10, + "times_ns": [ + 129473, + 117847, + 114304, + 112660, + 169242, + 116738, + 112220, + 110751, + 110533, + 110084 + ], + "mean_ns": 120385.2, + "stddev_ns": 17171.628104521715, + "min_ns": 110084, + "max_ns": 169242, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_grep_simple", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3352562, + 3554741, + 3384078, + 3440783, + 3238320, + 3303977, + 3264800, + 3252618, + 3426677, + 3400336 + ], + "mean_ns": 3361889.2, + "stddev_ns": 94689.32432412855, + "min_ns": 3238320, + "max_ns": 3554741, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_grep_case", + "category": "tools", + "iterations": 10, + "times_ns": [ + 204987, + 195370, + 243302, + 394955, + 222902, + 225201, + 257854, + 193889, + 186768, + 183696 + ], + "mean_ns": 230892.4, + "stddev_ns": 59472.97403224426, + "min_ns": 183696, + "max_ns": 394955, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_grep_case", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3375636, + 3399849, + 3447587, + 3374213, + 3320958, + 3314803, + 4394153, + 3343917, + 3475431, + 3407660 + ], + "mean_ns": 3485420.7, + "stddev_ns": 306805.52921714104, + "min_ns": 3314803, + "max_ns": 4394153, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_grep_count", + "category": "tools", + "iterations": 10, + "times_ns": [ + 119651, + 114354, + 116542, + 113882, + 160112, + 114790, + 110408, + 108061, + 105710, + 104782 + ], + "mean_ns": 116829.2, + "stddev_ns": 15123.82733173055, + "min_ns": 104782, + "max_ns": 160112, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_grep_count", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3869610, + 3967995, + 3963905, + 6604674, + 3481157, + 3518594, + 11614014, + 3526709, + 3257126, + 3321355 + ], + "mean_ns": 4712513.9, + "stddev_ns": 2478658.487261948, + "min_ns": 3257126, + "max_ns": 11614014, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_grep_invert", + "category": "tools", + "iterations": 10, + "times_ns": [ + 126047, + 122580, + 177043, + 121028, + 114859, + 114247, + 113517, + 111680, + 109102, + 108401 + ], + "mean_ns": 121850.4, + "stddev_ns": 19204.23188883117, + "min_ns": 108401, + "max_ns": 177043, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_grep_invert", + "category": "tools", + "iterations": 10, + "times_ns": [ + 8222286, + 3690904, + 4247933, + 3532315, + 3536763, + 3391386, + 3260201, + 3650865, + 4332660, + 3288506 + ], + "mean_ns": 4115381.9, + "stddev_ns": 1412139.983205521, + "min_ns": 3260201, + "max_ns": 8222286, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_grep_regex", + "category": "tools", + "iterations": 10, + "times_ns": [ + 158275, + 299769, + 181077, + 154201, + 151989, + 144626, + 186885, + 150581, + 143073, + 139766 + ], + "mean_ns": 171024.2, + "stddev_ns": 45397.006870056975, + "min_ns": 139766, + "max_ns": 299769, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_grep_regex", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3412084, + 3448992, + 3548565, + 3565145, + 3590263, + 3312004, + 3849492, + 3395041, + 3382487, + 3367602 + ], + "mean_ns": 3487167.5, + "stddev_ns": 149424.3050211377, + "min_ns": 3312004, + "max_ns": 3849492, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_sed_replace", + "category": "tools", + "iterations": 10, + "times_ns": [ + 118286, + 149881, + 192020, + 136474, + 114886, + 107847, + 105306, + 104229, + 105148, + 141330 + ], + "mean_ns": 127540.7, + "stddev_ns": 26644.888354241608, + "min_ns": 104229, + "max_ns": 192020, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_sed_replace", + "category": "tools", + "iterations": 10, + "times_ns": [ + 4202513, + 3765575, + 3574406, + 3910999, + 3962966, + 3779221, + 3446511, + 3467356, + 3658528, + 3594942 + ], + "mean_ns": 3736301.7, + "stddev_ns": 225942.42417131405, + "min_ns": 3446511, + "max_ns": 4202513, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_sed_global", + "category": "tools", + "iterations": 10, + "times_ns": [ + 140588, + 137834, + 134868, + 155253, + 141428, + 133147, + 132213, + 131905, + 126868, + 101193 + ], + "mean_ns": 133529.7, + "stddev_ns": 13034.503335762356, + "min_ns": 101193, + "max_ns": 155253, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_sed_global", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3425284, + 3429877, + 3368700, + 3314540, + 3505157, + 3614739, + 3420941, + 7765127, + 3581413, + 4803888 + ], + "mean_ns": 4022966.6, + "stddev_ns": 1313190.6353504963, + "min_ns": 3314540, + "max_ns": 7765127, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_sed_delete", + "category": "tools", + "iterations": 10, + "times_ns": [ + 109458, + 105495, + 197843, + 152250, + 105860, + 102238, + 101883, + 99869, + 99327, + 98955 + ], + "mean_ns": 117317.8, + "stddev_ns": 30770.69712827449, + "min_ns": 98955, + "max_ns": 197843, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_sed_delete", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3309917, + 3602364, + 3433598, + 3330561, + 3225846, + 3317586, + 3461885, + 3315925, + 3367312, + 3533934 + ], + "mean_ns": 3389892.8, + "stddev_ns": 110010.01974983914, + "min_ns": 3225846, + "max_ns": 3602364, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_sed_lines", + "category": "tools", + "iterations": 10, + "times_ns": [ + 109074, + 102386, + 101814, + 99772, + 146942, + 105195, + 101390, + 98420, + 97383, + 96387 + ], + "mean_ns": 105876.3, + "stddev_ns": 14145.43877757067, + "min_ns": 96387, + "max_ns": 146942, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_sed_lines", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3244267, + 5975843, + 6418054, + 5626525, + 4164268, + 4919193, + 4254529, + 3972087, + 4264668, + 8474106 + ], + "mean_ns": 5131354.0, + "stddev_ns": 1455787.6033701482, + "min_ns": 3244267, + "max_ns": 8474106, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_sed_backrefs", + "category": "tools", + "iterations": 10, + "times_ns": [ + 279639, + 270601, + 251419, + 186994, + 2529074, + 211201, + 150516, + 138725, + 136371, + 132415 + ], + "mean_ns": 428695.5, + "stddev_ns": 702186.1902330819, + "min_ns": 132415, + "max_ns": 2529074, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_sed_backrefs", + "category": "tools", + "iterations": 10, + "times_ns": [ + 5850013, + 4450705, + 4764618, + 4471429, + 4895560, + 5262948, + 5084147, + 4606389, + 4907294, + 8612424 + ], + "mean_ns": 5290552.7, + "stddev_ns": 1175376.179349918, + "min_ns": 4450705, + "max_ns": 8612424, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_awk_print", + "category": "tools", + "iterations": 10, + "times_ns": [ + 201933, + 236677, + 169603, + 258493, + 177073, + 218663, + 172502, + 185456, + 198966, + 171580 + ], + "mean_ns": 199094.6, + "stddev_ns": 28873.064226714836, + "min_ns": 169603, + "max_ns": 258493, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_awk_print", + "category": "tools", + "iterations": 10, + "times_ns": [ + 6497972, + 9717235, + 4962366, + 5470188, + 13894839, + 7287440, + 16035745, + 21595239, + 9673726, + 5059816 + ], + "mean_ns": 10019456.6, + "stddev_ns": 5255061.693996298, + "min_ns": 4962366, + "max_ns": 21595239, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_awk_sum", + "category": "tools", + "iterations": 10, + "times_ns": [ + 252694, + 225305, + 209538, + 275923, + 193578, + 235688, + 268218, + 211505, + 188076, + 252657 + ], + "mean_ns": 231318.2, + "stddev_ns": 29120.193892898445, + "min_ns": 188076, + "max_ns": 275923, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_awk_sum", + "category": "tools", + "iterations": 10, + "times_ns": [ + 5271757, + 4252421, + 3629078, + 3940675, + 7307763, + 8028193, + 4404290, + 5491411, + 3776988, + 3635577 + ], + "mean_ns": 4973815.3, + "stddev_ns": 1485831.5176482864, + "min_ns": 3629078, + "max_ns": 8028193, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_awk_pattern", + "category": "tools", + "iterations": 10, + "times_ns": [ + 179006, + 161011, + 150152, + 147831, + 178509, + 162016, + 143023, + 138079, + 136458, + 133837 + ], + "mean_ns": 152992.2, + "stddev_ns": 15717.346002426748, + "min_ns": 133837, + "max_ns": 179006, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_awk_pattern", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3225969, + 3029061, + 3097043, + 3189237, + 3133468, + 3286016, + 3150759, + 3109672, + 3105541, + 3286565 + ], + "mean_ns": 3161333.1, + "stddev_ns": 80302.12325642454, + "min_ns": 3029061, + "max_ns": 3286565, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_awk_fieldsep", + "category": "tools", + "iterations": 10, + "times_ns": [ + 119832, + 114001, + 111596, + 110723, + 148394, + 110425, + 106329, + 106357, + 107542, + 106979 + ], + "mean_ns": 114217.8, + "stddev_ns": 12058.372848771927, + "min_ns": 106329, + "max_ns": 148394, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_awk_fieldsep", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3475808, + 3158862, + 2978101, + 3247565, + 3090644, + 3280652, + 3021975, + 3229816, + 3252657, + 3251657 + ], + "mean_ns": 3198773.7, + "stddev_ns": 136284.82117833226, + "min_ns": 2978101, + "max_ns": 3475808, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_awk_nf", + "category": "tools", + "iterations": 10, + "times_ns": [ + 119129, + 112613, + 142461, + 128942, + 109781, + 108228, + 106953, + 104044, + 104935, + 105292 + ], + "mean_ns": 114237.8, + "stddev_ns": 11911.58421705526, + "min_ns": 104044, + "max_ns": 142461, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_awk_nf", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3033102, + 3025006, + 3023486, + 3217790, + 2971134, + 2963225, + 3141679, + 3114813, + 2991989, + 2999926 + ], + "mean_ns": 3048215.0, + "stddev_ns": 78716.61112751234, + "min_ns": 2963225, + "max_ns": 3217790, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_awk_compute", + "category": "tools", + "iterations": 10, + "times_ns": [ + 124669, + 118436, + 118978, + 119394, + 113221, + 112425, + 143705, + 112287, + 109839, + 109741 + ], + "mean_ns": 118269.5, + "stddev_ns": 9638.241211445167, + "min_ns": 109741, + "max_ns": 143705, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_awk_compute", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3077010, + 3089500, + 3117822, + 3016973, + 3397414, + 3027055, + 3062732, + 3035287, + 3171905, + 3100975 + ], + "mean_ns": 3109667.3, + "stddev_ns": 105564.83594649308, + "min_ns": 3016973, + "max_ns": 3397414, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_jq_identity", + "category": "tools", + "iterations": 10, + "times_ns": [ + 702534, + 618119, + 561147, + 577585, + 573560, + 560937, + 622891, + 569223, + 622512, + 581395 + ], + "mean_ns": 598990.3, + "stddev_ns": 41704.270234713375, + "min_ns": 560937, + "max_ns": 702534, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_jq_identity", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3852382, + 3775286, + 3727488, + 3837066, + 4696588, + 3678163, + 3807829, + 4049478, + 3747875, + 3926813 + ], + "mean_ns": 3909896.8, + "stddev_ns": 280896.2232479462, + "min_ns": 3678163, + "max_ns": 4696588, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_jq_field", + "category": "tools", + "iterations": 10, + "times_ns": [ + 702020, + 612153, + 647803, + 626000, + 668278, + 581615, + 635113, + 592680, + 854858, + 829601 + ], + "mean_ns": 675012.1, + "stddev_ns": 90113.4669163827, + "min_ns": 581615, + "max_ns": 854858, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_jq_field", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3819949, + 3793843, + 3693440, + 4504245, + 4006725, + 3956321, + 3870845, + 3728216, + 3763890, + 4004030 + ], + "mean_ns": 3914150.4, + "stddev_ns": 223097.3771742734, + "min_ns": 3693440, + "max_ns": 4504245, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_jq_array", + "category": "tools", + "iterations": 10, + "times_ns": [ + 628795, + 616535, + 614642, + 561050, + 587513, + 606831, + 844696, + 720807, + 1058262, + 742613 + ], + "mean_ns": 698174.4, + "stddev_ns": 145419.22175847317, + "min_ns": 561050, + "max_ns": 1058262, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_jq_array", + "category": "tools", + "iterations": 10, + "times_ns": [ + 4215091, + 3913374, + 4327628, + 4206853, + 6233301, + 3961096, + 3846488, + 3871210, + 4444825, + 4000069 + ], + "mean_ns": 4301993.5, + "stddev_ns": 672239.8897101019, + "min_ns": 3846488, + "max_ns": 6233301, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_jq_filter", + "category": "tools", + "iterations": 10, + "times_ns": [ + 654765, + 814022, + 610838, + 636261, + 570062, + 633406, + 743492, + 824501, + 593546, + 626329 + ], + "mean_ns": 670722.2, + "stddev_ns": 85999.07932507184, + "min_ns": 570062, + "max_ns": 824501, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_jq_filter", + "category": "tools", + "iterations": 10, + "times_ns": [ + 4551422, + 3727260, + 3753691, + 4059927, + 3808386, + 3839339, + 4790475, + 3779663, + 3658702, + 3916471 + ], + "mean_ns": 3988533.6, + "stddev_ns": 360664.156100991, + "min_ns": 3658702, + "max_ns": 4790475, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "tool_jq_map", + "category": "tools", + "iterations": 10, + "times_ns": [ + 619324, + 651086, + 647117, + 589364, + 598016, + 616631, + 680274, + 614288, + 574094, + 588499 + ], + "mean_ns": 617869.3, + "stddev_ns": 31392.986487589867, + "min_ns": 574094, + "max_ns": 680274, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "tool_jq_map", + "category": "tools", + "iterations": 10, + "times_ns": [ + 3826469, + 3690025, + 3643935, + 3733803, + 4968197, + 3827710, + 3711372, + 3825473, + 3940643, + 3794825 + ], + "mean_ns": 3896245.2, + "stddev_ns": 366423.9560243844, + "min_ns": 3643935, + "max_ns": 4968197, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_fibonacci", + "category": "complex", + "iterations": 10, + "times_ns": [ + 7859326, + 8088217, + 7732622, + 8099371, + 8212454, + 7880755, + 8031499, + 10427288, + 8001613, + 8337927 + ], + "mean_ns": 8267107.2, + "stddev_ns": 739036.3315937587, + "min_ns": 7732622, + "max_ns": 10427288, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_fibonacci", + "category": "complex", + "iterations": 10, + "times_ns": [ + 102500362, + 101850292, + 103118606, + 102872653, + 111059024, + 109316187, + 103784338, + 101793666, + 102850215, + 101412271 + ], + "mean_ns": 104055761.4, + "stddev_ns": 3160874.289079912, + "min_ns": 101412271, + "max_ns": 111059024, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_fibonacci_iter", + "category": "complex", + "iterations": 10, + "times_ns": [ + 175199, + 162530, + 162363, + 188368, + 161781, + 159650, + 156837, + 156497, + 155402, + 179681 + ], + "mean_ns": 165830.8, + "stddev_ns": 10685.545431095223, + "min_ns": 155402, + "max_ns": 188368, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_fibonacci_iter", + "category": "complex", + "iterations": 10, + "times_ns": [ + 1678723, + 1739153, + 1577580, + 1703147, + 1580743, + 1642950, + 1690014, + 1539317, + 1611593, + 1536942 + ], + "mean_ns": 1630016.2, + "stddev_ns": 67678.87097876264, + "min_ns": 1536942, + "max_ns": 1739153, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_nested_subst", + "category": "complex", + "iterations": 10, + "times_ns": [ + 117301, + 112992, + 189316, + 140764, + 119407, + 110630, + 108757, + 110232, + 109503, + 109555 + ], + "mean_ns": 122845.7, + "stddev_ns": 23959.38352316269, + "min_ns": 108757, + "max_ns": 189316, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_nested_subst", + "category": "complex", + "iterations": 10, + "times_ns": [ + 3284954, + 3153226, + 3096754, + 2986363, + 3250878, + 3115666, + 3071322, + 3250492, + 3025282, + 3080541 + ], + "mean_ns": 3131547.8, + "stddev_ns": 96152.77064214011, + "min_ns": 2986363, + "max_ns": 3284954, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_loop_compute", + "category": "complex", + "iterations": 10, + "times_ns": [ + 161506, + 155519, + 152336, + 150787, + 187271, + 151106, + 148879, + 149350, + 148009, + 152395 + ], + "mean_ns": 155715.8, + "stddev_ns": 11153.250152309864, + "min_ns": 148009, + "max_ns": 187271, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_loop_compute", + "category": "complex", + "iterations": 10, + "times_ns": [ + 4442936, + 3807049, + 2926699, + 2058464, + 2275566, + 2358064, + 2329834, + 2103272, + 2218425, + 2464444 + ], + "mean_ns": 2698475.3, + "stddev_ns": 761832.9048450256, + "min_ns": 2058464, + "max_ns": 4442936, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_string_build", + "category": "complex", + "iterations": 10, + "times_ns": [ + 162318, + 136506, + 193698, + 143181, + 132667, + 168018, + 107456, + 185974, + 136135, + 164663 + ], + "mean_ns": 153061.6, + "stddev_ns": 25164.54807541753, + "min_ns": 107456, + "max_ns": 193698, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_string_build", + "category": "complex", + "iterations": 10, + "times_ns": [ + 1805523, + 1560473, + 1673735, + 1914347, + 1835263, + 2349561, + 1899768, + 2077493, + 1932936, + 1745441 + ], + "mean_ns": 1879454.0, + "stddev_ns": 208364.5478655138, + "min_ns": 1560473, + "max_ns": 2349561, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_json_transform", + "category": "complex", + "iterations": 10, + "times_ns": [ + 660279, + 693706, + 651289, + 677162, + 679508, + 695725, + 633858, + 667902, + 664578, + 676288 + ], + "mean_ns": 670029.5, + "stddev_ns": 17859.50678070366, + "min_ns": 633858, + "max_ns": 695725, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_json_transform", + "category": "complex", + "iterations": 10, + "times_ns": [ + 6021661, + 6089138, + 9611246, + 8869176, + 7286555, + 18811827, + 8372634, + 14332344, + 11470284, + 9515025 + ], + "mean_ns": 10037989.0, + "stddev_ns": 3759827.429574049, + "min_ns": 6021661, + "max_ns": 18811827, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "complex_pipeline_text", + "category": "complex", + "iterations": 10, + "times_ns": [ + 321704, + 309769, + 418341, + 391557, + 384768, + 372004, + 304486, + 286400, + 565041, + 509644 + ], + "mean_ns": 386371.4, + "stddev_ns": 86675.37053880993, + "min_ns": 286400, + "max_ns": 565041, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "complex_pipeline_text", + "category": "complex", + "iterations": 10, + "times_ns": [ + 5578159, + 4866369, + 4412574, + 4601527, + 4689023, + 5119574, + 5439803, + 4807682, + 14071179, + 10374119 + ], + "mean_ns": 6396000.9, + "stddev_ns": 3047567.078618269, + "min_ns": 4412574, + "max_ns": 14071179, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_loop_1000", + "category": "large", + "iterations": 10, + "times_ns": [ + 4281686, + 4672176, + 5509303, + 5351799, + 5534808, + 3947516, + 4722614, + 4429144, + 4461545, + 4286793 + ], + "mean_ns": 4719738.4, + "stddev_ns": 530687.2676221279, + "min_ns": 3947516, + "max_ns": 5534808, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_loop_1000", + "category": "large", + "iterations": 10, + "times_ns": [ + 4065984, + 3921392, + 3887164, + 3984893, + 3905287, + 3901487, + 3960094, + 4179852, + 3962639, + 3957988 + ], + "mean_ns": 3972678.0, + "stddev_ns": 84737.13481585273, + "min_ns": 3887164, + "max_ns": 4179852, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_string_append_100", + "category": "large", + "iterations": 10, + "times_ns": [ + 402802, + 419188, + 415355, + 411148, + 542320, + 432913, + 397757, + 391446, + 413150, + 390474 + ], + "mean_ns": 421655.3, + "stddev_ns": 42103.06569134842, + "min_ns": 390474, + "max_ns": 542320, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_string_append_100", + "category": "large", + "iterations": 10, + "times_ns": [ + 1931846, + 1995831, + 1867723, + 1938359, + 1828883, + 1824294, + 1890914, + 1950657, + 1970237, + 1927130 + ], + "mean_ns": 1912587.4, + "stddev_ns": 54985.02135891192, + "min_ns": 1824294, + "max_ns": 1995831, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_array_fill_200", + "category": "large", + "iterations": 10, + "times_ns": [ + 1848954, + 1783157, + 1823964, + 1782452, + 1968743, + 2066801, + 1966643, + 1792320, + 1931880, + 1827186 + ], + "mean_ns": 1879210.0, + "stddev_ns": 92971.71820505416, + "min_ns": 1782452, + "max_ns": 2066801, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_array_fill_200", + "category": "large", + "iterations": 10, + "times_ns": [ + 2107196, + 2013994, + 2042434, + 2049373, + 2016095, + 1961501, + 1990108, + 2669420, + 2120388, + 1987366 + ], + "mean_ns": 2095787.5, + "stddev_ns": 197177.02679686088, + "min_ns": 1961501, + "max_ns": 2669420, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_nested_loops", + "category": "large", + "iterations": 10, + "times_ns": [ + 1871599, + 2343424, + 2189487, + 1885196, + 2070668, + 1896207, + 1863931, + 1831365, + 1972087, + 1911567 + ], + "mean_ns": 1983553.1, + "stddev_ns": 158784.80943808827, + "min_ns": 1831365, + "max_ns": 2343424, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_nested_loops", + "category": "large", + "iterations": 10, + "times_ns": [ + 3068176, + 3460078, + 2768228, + 4871018, + 2769090, + 2922197, + 2918153, + 2673809, + 2676247, + 2608800 + ], + "mean_ns": 3073579.6, + "stddev_ns": 643966.8045648317, + "min_ns": 2608800, + "max_ns": 4871018, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_fibonacci_12", + "category": "large", + "iterations": 10, + "times_ns": [ + 20033212, + 20484953, + 20807317, + 20502226, + 20936185, + 20072534, + 20376425, + 19676532, + 21205248, + 20072691 + ], + "mean_ns": 20416732.3, + "stddev_ns": 446044.12675206247, + "min_ns": 19676532, + "max_ns": 21205248, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_fibonacci_12", + "category": "large", + "iterations": 10, + "times_ns": [ + 267428256, + 270726474, + 378591642, + 330252034, + 277433908, + 275254311, + 277675782, + 279130661, + 264309810, + 268549537 + ], + "mean_ns": 288935241.5, + "stddev_ns": 34790515.54005834, + "min_ns": 264309810, + "max_ns": 378591642, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_function_calls_500", + "category": "large", + "iterations": 10, + "times_ns": [ + 9535600, + 9594944, + 9499008, + 9822678, + 10598894, + 9440282, + 9558423, + 9534476, + 9485271, + 9741343 + ], + "mean_ns": 9681091.9, + "stddev_ns": 325677.8358720317, + "min_ns": 9440282, + "max_ns": 10598894, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_function_calls_500", + "category": "large", + "iterations": 10, + "times_ns": [ + 249947702, + 254225318, + 230630481, + 233290671, + 237947667, + 280427031, + 355083412, + 252598564, + 247912887, + 244628973 + ], + "mean_ns": 258669270.6, + "stddev_ns": 34747973.16707044, + "min_ns": 230630481, + "max_ns": 355083412, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_multiline_script", + "category": "large", + "iterations": 10, + "times_ns": [ + 510981, + 489136, + 564852, + 471186, + 607545, + 486009, + 507120, + 468656, + 483981, + 460325 + ], + "mean_ns": 504979.1, + "stddev_ns": 44330.86150403576, + "min_ns": 460325, + "max_ns": 607545, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_multiline_script", + "category": "large", + "iterations": 10, + "times_ns": [ + 1927976, + 1955834, + 1827308, + 1771672, + 1894128, + 1778915, + 1751142, + 1785390, + 1755463, + 1864336 + ], + "mean_ns": 1831216.4, + "stddev_ns": 71058.80482276632, + "min_ns": 1751142, + "max_ns": 1955834, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_pipeline_chain", + "category": "large", + "iterations": 10, + "times_ns": [ + 1252075, + 1253124, + 1231577, + 1252581, + 1222058, + 1217593, + 1236588, + 1197717, + 1186937, + 1238979 + ], + "mean_ns": 1228922.9, + "stddev_ns": 21818.47680957587, + "min_ns": 1186937, + "max_ns": 1253124, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_pipeline_chain", + "category": "large", + "iterations": 10, + "times_ns": [ + 4059574, + 4165537, + 3918756, + 5118879, + 3635903, + 3975417, + 4395443, + 4031427, + 4074656, + 3972177 + ], + "mean_ns": 4134776.9, + "stddev_ns": 374790.02732555463, + "min_ns": 3635903, + "max_ns": 5118879, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "large_assoc_array", + "category": "large", + "iterations": 10, + "times_ns": [ + 116550, + 106906, + 102277, + 101191, + 98899, + 122925, + 106771, + 97533, + 96682, + 95800 + ], + "mean_ns": 104553.4, + "stddev_ns": 8533.542701598206, + "min_ns": 95800, + "max_ns": 122925, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "large_assoc_array", + "category": "large", + "iterations": 10, + "times_ns": [ + 1519614, + 1573081, + 1580581, + 1663620, + 1599092, + 1524134, + 1520999, + 1613969, + 1527930, + 1557180 + ], + "mean_ns": 1568020.0, + "stddev_ns": 45392.0061244268, + "min_ns": 1519614, + "max_ns": 1663620, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "subshell_simple", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 90852, + 87567, + 84659, + 85767, + 106983, + 87642, + 83054, + 81889, + 83926, + 84125 + ], + "mean_ns": 87646.4, + "stddev_ns": 6907.404899091988, + "min_ns": 81889, + "max_ns": 106983, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "subshell_simple", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 1898259, + 1838304, + 1895047, + 1856204, + 1799397, + 1832777, + 1815032, + 1867176, + 1815392, + 1935937 + ], + "mean_ns": 1855352.5, + "stddev_ns": 41478.801490038255, + "min_ns": 1799397, + "max_ns": 1935937, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "subshell_isolation", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 137442, + 103395, + 99553, + 97806, + 99762, + 100855, + 99011, + 96844, + 122232, + 96120 + ], + "mean_ns": 105302.0, + "stddev_ns": 12877.783753425898, + "min_ns": 96120, + "max_ns": 137442, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "subshell_isolation", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 1842472, + 1947228, + 1932875, + 1901735, + 1896382, + 1982894, + 1951411, + 1931328, + 2023045, + 1949917 + ], + "mean_ns": 1935928.7, + "stddev_ns": 46750.22391400922, + "min_ns": 1842472, + "max_ns": 2023045, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "subshell_nested", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 130718, + 125467, + 127599, + 122747, + 145715, + 128789, + 120684, + 118393, + 119011, + 116528 + ], + "mean_ns": 125565.1, + "stddev_ns": 8092.848688193793, + "min_ns": 116528, + "max_ns": 145715, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "subshell_nested", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 3465203, + 3393678, + 3421915, + 3423879, + 3453199, + 3426088, + 3431674, + 3361221, + 3476911, + 3501794 + ], + "mean_ns": 3435556.2, + "stddev_ns": 38722.771070263036, + "min_ns": 3361221, + "max_ns": 3501794, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "subshell_pipeline", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 148771, + 137298, + 130868, + 131970, + 128997, + 180514, + 252548, + 140992, + 129719, + 127062 + ], + "mean_ns": 150873.9, + "stddev_ns": 37085.395959730566, + "min_ns": 127062, + "max_ns": 252548, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "subshell_pipeline", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 2988943, + 2930547, + 2999453, + 2931265, + 2900236, + 2982392, + 2898034, + 3024973, + 2926047, + 2936016 + ], + "mean_ns": 2951790.6, + "stddev_ns": 41564.31777185811, + "min_ns": 2898034, + "max_ns": 3024973, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "subshell_capture_loop", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 185267, + 175227, + 171281, + 170546, + 171893, + 201949, + 172319, + 165565, + 164877, + 162758 + ], + "mean_ns": 174168.2, + "stddev_ns": 11030.2480099044, + "min_ns": 162758, + "max_ns": 201949, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "subshell_capture_loop", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 3844089, + 3587438, + 3824637, + 3809203, + 3905269, + 3810756, + 4658679, + 3913827, + 3959058, + 3991634 + ], + "mean_ns": 3930459.0, + "stddev_ns": 264788.4280175401, + "min_ns": 3587438, + "max_ns": 4658679, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "subshell_process_subst", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 142024, + 134168, + 135254, + 131261, + 126216, + 123421, + 153644, + 125049, + 123865, + 121395 + ], + "mean_ns": 131629.7, + "stddev_ns": 9578.212255426375, + "min_ns": 121395, + "max_ns": 153644, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "subshell_process_subst", + "category": "subshell", + "iterations": 10, + "times_ns": [ + 2686050, + 2546609, + 2448345, + 2653364, + 2442009, + 2472487, + 2666117, + 2546212, + 2611386, + 2506265 + ], + "mean_ns": 2557884.4, + "stddev_ns": 87043.74668659431, + "min_ns": 2442009, + "max_ns": 2686050, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "io_redirect_write", + "category": "io", + "iterations": 10, + "times_ns": [ + 170489, + 144339, + 134809, + 131766, + 129217, + 130234, + 127441, + 128684, + 160348, + 130014 + ], + "mean_ns": 138734.1, + "stddev_ns": 14276.959525403157, + "min_ns": 127441, + "max_ns": 170489, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "io_redirect_write", + "category": "io", + "iterations": 10, + "times_ns": [ + 3829213, + 3814634, + 3896692, + 4030953, + 3912443, + 3668985, + 3703221, + 3702212, + 3779605, + 3665864 + ], + "mean_ns": 3800382.2, + "stddev_ns": 114411.61322593087, + "min_ns": 3665864, + "max_ns": 4030953, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "io_append", + "category": "io", + "iterations": 10, + "times_ns": [ + 168412, + 166302, + 223115, + 160620, + 194066, + 158928, + 154489, + 153693, + 219899, + 156766 + ], + "mean_ns": 175629.0, + "stddev_ns": 25459.47373768751, + "min_ns": 153693, + "max_ns": 223115, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "io_append", + "category": "io", + "iterations": 10, + "times_ns": [ + 4544811, + 3943611, + 3844745, + 3722132, + 3705533, + 3719787, + 3825804, + 3732284, + 3794803, + 3726008 + ], + "mean_ns": 3855951.8, + "stddev_ns": 240465.86320340773, + "min_ns": 3705533, + "max_ns": 4544811, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "io_dev_null", + "category": "io", + "iterations": 10, + "times_ns": [ + 90571, + 85338, + 83306, + 84473, + 83467, + 80967, + 81965, + 81897, + 81642, + 80846 + ], + "mean_ns": 83447.2, + "stddev_ns": 2759.939557309181, + "min_ns": 80846, + "max_ns": 90571, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "io_dev_null", + "category": "io", + "iterations": 10, + "times_ns": [ + 1528137, + 1549287, + 1472619, + 1553965, + 1499869, + 1547161, + 1518849, + 1570776, + 1556366, + 1502551 + ], + "mean_ns": 1529958.0, + "stddev_ns": 29462.44983025003, + "min_ns": 1472619, + "max_ns": 1570776, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "io_stderr_redirect", + "category": "io", + "iterations": 10, + "times_ns": [ + 89118, + 86461, + 86309, + 82959, + 82771, + 83566, + 82745, + 105294, + 86882, + 87877 + ], + "mean_ns": 87398.2, + "stddev_ns": 6350.065240609737, + "min_ns": 82745, + "max_ns": 105294, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "io_stderr_redirect", + "category": "io", + "iterations": 10, + "times_ns": [ + 1491201, + 1500487, + 1539729, + 1618797, + 1492270, + 1538849, + 1542460, + 1582808, + 1470846, + 1461996 + ], + "mean_ns": 1523944.3, + "stddev_ns": 47496.062038973294, + "min_ns": 1461996, + "max_ns": 1618797, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "io_read_lines", + "category": "io", + "iterations": 10, + "times_ns": [ + 153459, + 181596, + 149022, + 145668, + 143903, + 143453, + 143218, + 171710, + 146397, + 142462 + ], + "mean_ns": 152088.8, + "stddev_ns": 12858.938702707934, + "min_ns": 142462, + "max_ns": 181596, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "io_read_lines", + "category": "io", + "iterations": 10, + "times_ns": [ + 1584129, + 1574028, + 1550963, + 1626787, + 1592166, + 1585623, + 1578128, + 1571178, + 1638535, + 1588090 + ], + "mean_ns": 1588962.7, + "stddev_ns": 24564.894317094062, + "min_ns": 1550963, + "max_ns": 1638535, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bashkit", + "case_name": "io_multiline_heredoc", + "category": "io", + "iterations": 10, + "times_ns": [ + 178889, + 193018, + 170060, + 153642, + 151507, + 167717, + 148589, + 186537, + 227687, + 148623 + ], + "mean_ns": 172626.9, + "stddev_ns": 23814.484875596198, + "min_ns": 148589, + "max_ns": 227687, + "errors": 0, + "error_messages": [], + "output_match": true + }, + { + "runner": "bash", + "case_name": "io_multiline_heredoc", + "category": "io", + "iterations": 10, + "times_ns": [ + 3220276, + 3137273, + 3222521, + 3153652, + 3261936, + 3244395, + 3108288, + 3164955, + 3077989, + 3220351 + ], + "mean_ns": 3181163.6, + "stddev_ns": 58480.851577589056, + "min_ns": 3077989, + "max_ns": 3261936, + "errors": 0, + "error_messages": [], + "output_match": true + } + ], + "summary": { + "total_cases": 96, + "runner_stats": { + "bashkit": { + "total_time_ms": 63.206590000000006, + "avg_time_ms": 0.6584019791666668, + "error_count": 0, + "error_rate": 0.0, + "output_match_rate": 1.0 + }, + "bash": { + "total_time_ms": 906.8898596, + "avg_time_ms": 9.446769370833334, + "error_count": 0, + "error_rate": 0.0, + "output_match_rate": 1.0 + } + } + } +} \ No newline at end of file diff --git a/crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.md b/crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.md new file mode 100644 index 000000000..b8d5765d0 --- /dev/null +++ b/crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.md @@ -0,0 +1,308 @@ +# Bashkit Benchmark Report + +## System Information + +- **Moniker**: `1600ca61ae8a-linux-x86_64` +- **Hostname**: 1600ca61ae8a +- **OS**: linux +- **Architecture**: x86_64 +- **CPUs**: 4 +- **Timestamp**: 1795653547 +- **Iterations**: 10 +- **Warmup**: 2 +- **Prewarm cases**: 3 + +- **bash executable**: `/usr/bin/bash (GNU Bash 5.2.37(1)-release)` + +## Summary + +Benchmarked 96 cases across 2 runners. + +| Runner | Total Time (ms) | Avg/Case (ms) | Errors | Error Rate | Output Match | +|--------|-----------------|---------------|--------|------------|-------------| +| bashkit | 63.21 | 0.658 | 0 | 0.0% | 100.0% | +| bash | 906.89 | 9.447 | 0 | 0.0% | 100.0% | + +## Performance Comparison + +**Bashkit is 14.3x faster** than bash on average. + +## Results by Category + +### Arithmetic + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| arith_basic | bashkit | 0.085 | ±0.015 | - | ✓ | +| arith_basic | bash | 1.690 | ±0.139 | - | ✓ | +| arith_complex | bashkit | 0.089 | ±0.010 | - | ✓ | +| arith_complex | bash | 1.608 | ±0.103 | - | ✓ | +| arith_variables | bashkit | 0.100 | ±0.016 | - | ✓ | +| arith_variables | bash | 1.633 | ±0.110 | - | ✓ | +| arith_increment | bashkit | 0.098 | ±0.014 | - | ✓ | +| arith_increment | bash | 1.648 | ±0.119 | - | ✓ | +| arith_modulo | bashkit | 0.085 | ±0.011 | - | ✓ | +| arith_modulo | bash | 1.643 | ±0.105 | - | ✓ | +| arith_loop_sum | bashkit | 0.158 | ±0.039 | - | ✓ | +| arith_loop_sum | bash | 1.783 | ±0.366 | - | ✓ | + +### Arrays + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| arr_create | bashkit | 0.093 | ±0.004 | - | ✓ | +| arr_create | bash | 1.607 | ±0.056 | - | ✓ | +| arr_all | bashkit | 0.098 | ±0.027 | - | ✓ | +| arr_all | bash | 1.817 | ±0.437 | - | ✓ | +| arr_length | bashkit | 0.094 | ±0.007 | - | ✓ | +| arr_length | bash | 1.590 | ±0.046 | - | ✓ | +| arr_iterate | bashkit | 0.106 | ±0.014 | - | ✓ | +| arr_iterate | bash | 1.640 | ±0.076 | - | ✓ | +| arr_slice | bashkit | 0.108 | ±0.031 | - | ✓ | +| arr_slice | bash | 1.750 | ±0.198 | - | ✓ | +| arr_assign_index | bashkit | 0.111 | ±0.039 | - | ✓ | +| arr_assign_index | bash | 1.714 | ±0.120 | - | ✓ | + +### Complex + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| complex_fibonacci | bashkit | 8.267 | ±0.739 | - | ✓ | +| complex_fibonacci | bash | 104.056 | ±3.161 | - | ✓ | +| complex_fibonacci_iter | bashkit | 0.166 | ±0.011 | - | ✓ | +| complex_fibonacci_iter | bash | 1.630 | ±0.068 | - | ✓ | +| complex_nested_subst | bashkit | 0.123 | ±0.024 | - | ✓ | +| complex_nested_subst | bash | 3.132 | ±0.096 | - | ✓ | +| complex_loop_compute | bashkit | 0.156 | ±0.011 | - | ✓ | +| complex_loop_compute | bash | 2.698 | ±0.762 | - | ✓ | +| complex_string_build | bashkit | 0.153 | ±0.025 | - | ✓ | +| complex_string_build | bash | 1.879 | ±0.208 | - | ✓ | +| complex_json_transform | bashkit | 0.670 | ±0.018 | - | ✓ | +| complex_json_transform | bash | 10.038 | ±3.760 | - | ✓ | +| complex_pipeline_text | bashkit | 0.386 | ±0.087 | - | ✓ | +| complex_pipeline_text | bash | 6.396 | ±3.048 | - | ✓ | + +### Control + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| ctrl_if_simple | bashkit | 0.095 | ±0.019 | - | ✓ | +| ctrl_if_simple | bash | 1.586 | ±0.058 | - | ✓ | +| ctrl_if_else | bashkit | 0.090 | ±0.010 | - | ✓ | +| ctrl_if_else | bash | 1.647 | ±0.087 | - | ✓ | +| ctrl_for_list | bashkit | 0.118 | ±0.013 | - | ✓ | +| ctrl_for_list | bash | 1.601 | ±0.050 | - | ✓ | +| ctrl_for_range | bashkit | 0.132 | ±0.025 | - | ✓ | +| ctrl_for_range | bash | 1.711 | ±0.179 | - | ✓ | +| ctrl_while | bashkit | 0.183 | ±0.036 | - | ✓ | +| ctrl_while | bash | 1.716 | ±0.098 | - | ✓ | +| ctrl_case | bashkit | 0.107 | ±0.024 | - | ✓ | +| ctrl_case | bash | 1.622 | ±0.099 | - | ✓ | +| ctrl_function | bashkit | 0.100 | ±0.007 | - | ✓ | +| ctrl_function | bash | 1.702 | ±0.159 | - | ✓ | +| ctrl_function_return | bashkit | 0.123 | ±0.009 | - | ✓ | +| ctrl_function_return | bash | 2.251 | ±0.182 | - | ✓ | +| ctrl_nested_loops | bashkit | 0.144 | ±0.012 | - | ✓ | +| ctrl_nested_loops | bash | 1.690 | ±0.116 | - | ✓ | + +### Io + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| io_redirect_write | bashkit | 0.139 | ±0.014 | - | ✓ | +| io_redirect_write | bash | 3.800 | ±0.114 | - | ✓ | +| io_append | bashkit | 0.176 | ±0.025 | - | ✓ | +| io_append | bash | 3.856 | ±0.240 | - | ✓ | +| io_dev_null | bashkit | 0.083 | ±0.003 | - | ✓ | +| io_dev_null | bash | 1.530 | ±0.029 | - | ✓ | +| io_stderr_redirect | bashkit | 0.087 | ±0.006 | - | ✓ | +| io_stderr_redirect | bash | 1.524 | ±0.047 | - | ✓ | +| io_read_lines | bashkit | 0.152 | ±0.013 | - | ✓ | +| io_read_lines | bash | 1.589 | ±0.025 | - | ✓ | +| io_multiline_heredoc | bashkit | 0.173 | ±0.024 | - | ✓ | +| io_multiline_heredoc | bash | 3.181 | ±0.058 | - | ✓ | + +### Large + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| large_loop_1000 | bashkit | 4.720 | ±0.531 | - | ✓ | +| large_loop_1000 | bash | 3.973 | ±0.085 | - | ✓ | +| large_string_append_100 | bashkit | 0.422 | ±0.042 | - | ✓ | +| large_string_append_100 | bash | 1.913 | ±0.055 | - | ✓ | +| large_array_fill_200 | bashkit | 1.879 | ±0.093 | - | ✓ | +| large_array_fill_200 | bash | 2.096 | ±0.197 | - | ✓ | +| large_nested_loops | bashkit | 1.984 | ±0.159 | - | ✓ | +| large_nested_loops | bash | 3.074 | ±0.644 | - | ✓ | +| large_fibonacci_12 | bashkit | 20.417 | ±0.446 | - | ✓ | +| large_fibonacci_12 | bash | 288.935 | ±34.791 | - | ✓ | +| large_function_calls_500 | bashkit | 9.681 | ±0.326 | - | ✓ | +| large_function_calls_500 | bash | 258.669 | ±34.748 | - | ✓ | +| large_multiline_script | bashkit | 0.505 | ±0.044 | - | ✓ | +| large_multiline_script | bash | 1.831 | ±0.071 | - | ✓ | +| large_pipeline_chain | bashkit | 1.229 | ±0.022 | - | ✓ | +| large_pipeline_chain | bash | 4.135 | ±0.375 | - | ✓ | +| large_assoc_array | bashkit | 0.105 | ±0.009 | - | ✓ | +| large_assoc_array | bash | 1.568 | ±0.045 | - | ✓ | + +### Pipes + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| pipe_simple | bashkit | 0.111 | ±0.014 | - | ✓ | +| pipe_simple | bash | 3.222 | ±0.172 | - | ✓ | +| pipe_multi | bashkit | 0.243 | ±0.052 | - | ✓ | +| pipe_multi | bash | 4.327 | ±0.957 | - | ✓ | +| pipe_command_subst | bashkit | 0.150 | ±0.116 | - | ✓ | +| pipe_command_subst | bash | 2.221 | ±0.091 | - | ✓ | +| pipe_heredoc | bashkit | 0.101 | ±0.012 | - | ✓ | +| pipe_heredoc | bash | 3.569 | ±1.293 | - | ✓ | +| pipe_herestring | bashkit | 0.095 | ±0.009 | - | ✓ | +| pipe_herestring | bash | 2.925 | ±0.090 | - | ✓ | +| pipe_discard | bashkit | 0.098 | ±0.007 | - | ✓ | +| pipe_discard | bash | 2.123 | ±0.058 | - | ✓ | + +### Startup + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| startup_empty | bashkit | 0.077 | ±0.009 | - | ✓ | +| startup_empty | bash | 5.180 | ±7.011 | - | ✓ | +| startup_true | bashkit | 0.074 | ±0.008 | - | ✓ | +| startup_true | bash | 1.564 | ±0.052 | - | ✓ | +| startup_echo | bashkit | 0.079 | ±0.008 | - | ✓ | +| startup_echo | bash | 1.567 | ±0.086 | - | ✓ | +| startup_exit | bashkit | 0.086 | ±0.016 | - | ✓ | +| startup_exit | bash | 1.530 | ±0.050 | - | ✓ | + +### Strings + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| str_concat | bashkit | 0.093 | ±0.015 | - | ✓ | +| str_concat | bash | 1.624 | ±0.072 | - | ✓ | +| str_printf | bashkit | 0.087 | ±0.012 | - | ✓ | +| str_printf | bash | 1.604 | ±0.064 | - | ✓ | +| str_printf_pad | bashkit | 0.083 | ±0.007 | - | ✓ | +| str_printf_pad | bash | 1.632 | ±0.082 | - | ✓ | +| str_echo_escape | bashkit | 0.089 | ±0.022 | - | ✓ | +| str_echo_escape | bash | 1.712 | ±0.180 | - | ✓ | +| str_prefix_strip | bashkit | 0.089 | ±0.010 | - | ✓ | +| str_prefix_strip | bash | 1.694 | ±0.133 | - | ✓ | +| str_suffix_strip | bashkit | 0.089 | ±0.008 | - | ✓ | +| str_suffix_strip | bash | 1.634 | ±0.053 | - | ✓ | +| str_uppercase | bashkit | 0.097 | ±0.020 | - | ✓ | +| str_uppercase | bash | 1.673 | ±0.053 | - | ✓ | +| str_lowercase | bashkit | 0.091 | ±0.012 | - | ✓ | +| str_lowercase | bash | 1.633 | ±0.104 | - | ✓ | + +### Subshell + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| subshell_simple | bashkit | 0.088 | ±0.007 | - | ✓ | +| subshell_simple | bash | 1.855 | ±0.041 | - | ✓ | +| subshell_isolation | bashkit | 0.105 | ±0.013 | - | ✓ | +| subshell_isolation | bash | 1.936 | ±0.047 | - | ✓ | +| subshell_nested | bashkit | 0.126 | ±0.008 | - | ✓ | +| subshell_nested | bash | 3.436 | ±0.039 | - | ✓ | +| subshell_pipeline | bashkit | 0.151 | ±0.037 | - | ✓ | +| subshell_pipeline | bash | 2.952 | ±0.042 | - | ✓ | +| subshell_capture_loop | bashkit | 0.174 | ±0.011 | - | ✓ | +| subshell_capture_loop | bash | 3.930 | ±0.265 | - | ✓ | +| subshell_process_subst | bashkit | 0.132 | ±0.010 | - | ✓ | +| subshell_process_subst | bash | 2.558 | ±0.087 | - | ✓ | + +### Tools + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| tool_grep_simple | bashkit | 0.120 | ±0.017 | - | ✓ | +| tool_grep_simple | bash | 3.362 | ±0.095 | - | ✓ | +| tool_grep_case | bashkit | 0.231 | ±0.059 | - | ✓ | +| tool_grep_case | bash | 3.485 | ±0.307 | - | ✓ | +| tool_grep_count | bashkit | 0.117 | ±0.015 | - | ✓ | +| tool_grep_count | bash | 4.713 | ±2.479 | - | ✓ | +| tool_grep_invert | bashkit | 0.122 | ±0.019 | - | ✓ | +| tool_grep_invert | bash | 4.115 | ±1.412 | - | ✓ | +| tool_grep_regex | bashkit | 0.171 | ±0.045 | - | ✓ | +| tool_grep_regex | bash | 3.487 | ±0.149 | - | ✓ | +| tool_sed_replace | bashkit | 0.128 | ±0.027 | - | ✓ | +| tool_sed_replace | bash | 3.736 | ±0.226 | - | ✓ | +| tool_sed_global | bashkit | 0.134 | ±0.013 | - | ✓ | +| tool_sed_global | bash | 4.023 | ±1.313 | - | ✓ | +| tool_sed_delete | bashkit | 0.117 | ±0.031 | - | ✓ | +| tool_sed_delete | bash | 3.390 | ±0.110 | - | ✓ | +| tool_sed_lines | bashkit | 0.106 | ±0.014 | - | ✓ | +| tool_sed_lines | bash | 5.131 | ±1.456 | - | ✓ | +| tool_sed_backrefs | bashkit | 0.429 | ±0.702 | - | ✓ | +| tool_sed_backrefs | bash | 5.291 | ±1.175 | - | ✓ | +| tool_awk_print | bashkit | 0.199 | ±0.029 | - | ✓ | +| tool_awk_print | bash | 10.019 | ±5.255 | - | ✓ | +| tool_awk_sum | bashkit | 0.231 | ±0.029 | - | ✓ | +| tool_awk_sum | bash | 4.974 | ±1.486 | - | ✓ | +| tool_awk_pattern | bashkit | 0.153 | ±0.016 | - | ✓ | +| tool_awk_pattern | bash | 3.161 | ±0.080 | - | ✓ | +| tool_awk_fieldsep | bashkit | 0.114 | ±0.012 | - | ✓ | +| tool_awk_fieldsep | bash | 3.199 | ±0.136 | - | ✓ | +| tool_awk_nf | bashkit | 0.114 | ±0.012 | - | ✓ | +| tool_awk_nf | bash | 3.048 | ±0.079 | - | ✓ | +| tool_awk_compute | bashkit | 0.118 | ±0.010 | - | ✓ | +| tool_awk_compute | bash | 3.110 | ±0.106 | - | ✓ | +| tool_jq_identity | bashkit | 0.599 | ±0.042 | - | ✓ | +| tool_jq_identity | bash | 3.910 | ±0.281 | - | ✓ | +| tool_jq_field | bashkit | 0.675 | ±0.090 | - | ✓ | +| tool_jq_field | bash | 3.914 | ±0.223 | - | ✓ | +| tool_jq_array | bashkit | 0.698 | ±0.145 | - | ✓ | +| tool_jq_array | bash | 4.302 | ±0.672 | - | ✓ | +| tool_jq_filter | bashkit | 0.671 | ±0.086 | - | ✓ | +| tool_jq_filter | bash | 3.989 | ±0.361 | - | ✓ | +| tool_jq_map | bashkit | 0.618 | ±0.031 | - | ✓ | +| tool_jq_map | bash | 3.896 | ±0.366 | - | ✓ | + +### Variables + +| Benchmark | Runner | Mean (ms) | StdDev | Errors | Match | +|-----------|--------|-----------|--------|--------|-------| +| var_assign_simple | bashkit | 0.088 | ±0.011 | - | ✓ | +| var_assign_simple | bash | 1.561 | ±0.052 | - | ✓ | +| var_assign_many | bashkit | 0.109 | ±0.010 | - | ✓ | +| var_assign_many | bash | 2.193 | ±1.797 | - | ✓ | +| var_default | bashkit | 0.085 | ±0.009 | - | ✓ | +| var_default | bash | 1.560 | ±0.086 | - | ✓ | +| var_length | bashkit | 0.089 | ±0.011 | - | ✓ | +| var_length | bash | 1.579 | ±0.058 | - | ✓ | +| var_substring | bashkit | 0.089 | ±0.007 | - | ✓ | +| var_substring | bash | 1.659 | ±0.071 | - | ✓ | +| var_replace | bashkit | 0.092 | ±0.007 | - | ✓ | +| var_replace | bash | 1.618 | ±0.080 | - | ✓ | +| var_nested | bashkit | 0.106 | ±0.027 | - | ✓ | +| var_nested | bash | 1.593 | ±0.053 | - | ✓ | +| var_export | bashkit | 0.090 | ±0.009 | - | ✓ | +| var_export | bash | 1.621 | ±0.086 | - | ✓ | + +## Runner Descriptions + +| Runner | Type | Description | +|--------|------|-------------| +| bashkit | in-process | Rust library call, no fork/exec | +| bashkit-cli | subprocess | bashkit binary, new process per run | +| bashkit-js | persistent child | Node.js + @everruns/bashkit, warm interpreter | +| bashkit-py | persistent child | Python + bashkit package, warm interpreter | +| bash | subprocess | PATH-selected Bash >=4, new process per run | +| gbash | subprocess | gbash binary (Go), new process per run | +| gbash-server | persistent child | gbash JSON-RPC server, warm interpreter | +| just-bash | subprocess | just-bash CLI, new process per run | +| just-bash-inproc | persistent child | Node.js + just-bash library, warm interpreter | + +## Assumptions & Notes + +- Times measured in nanoseconds, displayed in milliseconds +- Prewarm phase runs first few cases to warm up JIT/compilation +- Per-benchmark warmup iterations excluded from timing +- Output match compares against bash output when available +- Errors include execution failures and exit code mismatches +- In-process: interpreter runs inside the benchmark process +- Subprocess: new process spawned per benchmark run +- Persistent child: long-lived child process, amortizes startup cost + diff --git a/crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md b/crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md new file mode 100644 index 000000000..6795675be --- /dev/null +++ b/crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md @@ -0,0 +1,75 @@ +# Criterion Parallel Execution Benchmark + +## System Information + +- **Moniker**: `1600ca61ae8a-linux-x86_64` +- **Hostname**: 1600ca61ae8a +- **OS**: linux +- **Architecture**: x86_64 +- **CPUs**: 5 +- **Timestamp**: 1795653579 + +## Workload Comparison (50 sessions) + +| Benchmark | Time | +|-----------|------| +| workload_types/light_sequential | 5.7097 ms | +| workload_types/light_parallel | 2.1760 ms | +| workload_types/medium_sequential | 23.884 ms | +| workload_types/medium_parallel | 8.0467 ms | +| workload_types/heavy_sequential | 66.525 ms | +| workload_types/heavy_parallel | 22.401 ms | + +## Parallel Scaling (medium workload) + +| Benchmark | Time | +|-----------|------| +| parallel_scaling/medium_seq/10 | 4.5028 ms | +| parallel_scaling/medium_par/10 | 1.6563 ms | +| parallel_scaling/shared_fs/10 | 1.1640 ms | +| parallel_scaling/medium_seq/50 | 22.868 ms | +| parallel_scaling/medium_par/50 | 7.6553 ms | +| parallel_scaling/shared_fs/50 | 5.3160 ms | +| parallel_scaling/medium_seq/100 | 45.850 ms | +| parallel_scaling/medium_par/100 | 16.148 ms | +| parallel_scaling/shared_fs/100 | 10.472 ms | +| parallel_scaling/medium_seq/200 | 91.352 ms | +| parallel_scaling/medium_par/200 | 30.679 ms | +| parallel_scaling/shared_fs/200 | 28.013 ms | +| parallel_scaling/medium_seq/500 | 235.53 ms | +| parallel_scaling/medium_par/500 | 94.576 ms | +| parallel_scaling/shared_fs/500 | 60.677 ms | +| parallel_scaling/medium_seq/1000 | 451.09 ms | +| parallel_scaling/medium_par/1000 | 149.05 ms | +| parallel_scaling/shared_fs/1000 | 143.27 ms | + +## Single Operations + +| Benchmark | Time | +|-----------|------| +| single_bash_new | 59.559 µs | +| single_echo | 77.715 µs | +| single_file_write_read | 117.22 µs | +| single_grep | 127.94 µs | +| single_awk | 132.17 µs | +| single_sed | 115.50 µs | +| single_light_script | 110.49 µs | +| single_medium_script | 455.89 µs | +| single_heavy_script | 1.3301 ms | + +## Speedup Summary + +| Workload | Sequential | Parallel | Speedup | +|----------|-----------|----------|---------| +| light | 5.710 ms | 2.176 ms | **2.62x** | +| medium | 23.884 ms | 8.047 ms | **2.97x** | +| heavy | 66.525 ms | 22.401 ms | **2.97x** | + +| Sessions | Sequential | Parallel | Shared FS | Par Speedup | +|----------|-----------|----------|-----------|-------------| +| 10 | 4.503 ms | 1.656 ms | 1.164 ms | **2.72x** | +| 50 | 22.868 ms | 7.655 ms | 5.316 ms | **2.99x** | +| 100 | 45.850 ms | 16.148 ms | 10.472 ms | **2.84x** | +| 200 | 91.352 ms | 30.679 ms | 28.013 ms | **2.98x** | +| 500 | 235.530 ms | 94.576 ms | 60.677 ms | **2.49x** | +| 1000 | 451.090 ms | 149.050 ms | 143.270 ms | **3.03x** | diff --git a/site/src/data/performance-timeline.json b/site/src/data/performance-timeline.json index 557995d79..e13d2b02a 100644 --- a/site/src/data/performance-timeline.json +++ b/site/src/data/performance-timeline.json @@ -1,5 +1,5 @@ { - "generatedAt": "2026-11-26T00:09:34.000Z", + "generatedAt": "2026-11-26T00:39:39.000Z", "sources": { "bench": "crates/bashkit-bench/results/*.json", "criterion": "crates/bashkit/benches/results/*.md", @@ -8,21 +8,21 @@ "oilsSpec": "scripts/oils-spec/results/oils-spec-*.json" }, "summary": { - "benchRuns": 17, - "criterionRuns": 30, + "benchRuns": 18, + "criterionRuns": 31, "evalRuns": 58, "latestBench": { - "id": "bench-454522b0b8c5-linux-x86_64-1795580000", + "id": "bench-1600ca61ae8a-linux-x86_64-1795653548", "kind": "bashkit-bench", - "label": "454522b0b8c5-linux-x86_64", - "date": "2026-11-25", - "timestamp": "2026-11-25T04:13:20.000Z", - "source": "crates/bashkit-bench/results/bench-454522b0b8c5-linux-x86_64-1795580000.json", - "reportSource": "crates/bashkit-bench/results/bench-454522b0b8c5-linux-x86_64-1795580000.md", + "label": "1600ca61ae8a-linux-x86_64", + "date": "2026-11-26", + "timestamp": "2026-11-26T00:39:07.000Z", + "source": "crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json", + "reportSource": "crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.md", "cases": 96, - "speedup": 14.2, - "bashkitMs": 62.36, - "bashMs": 884.71, + "speedup": 14.3, + "bashkitMs": 63.21, + "bashMs": 906.89, "errorRate": 0, "matchRate": 100, "categories": [ @@ -30,97 +30,97 @@ "category": "startup", "description": "Small commands where interpreter startup dominates runtime.", "cases": 4, - "bashkitMedianMs": 0.082, - "bashMedianMs": 1.538, - "speedup": 19 + "bashkitMedianMs": 0.078, + "bashMedianMs": 1.565, + "speedup": 20.5 }, { "category": "strings", "description": "String expansion, pattern handling, and text manipulation.", "cases": 8, "bashkitMedianMs": 0.089, - "bashMedianMs": 1.537, - "speedup": 17.2 + "bashMedianMs": 1.633, + "speedup": 18.4 }, { "category": "variables", "description": "Variable assignment, lookup, expansion, and environment handling.", "cases": 8, "bashkitMedianMs": 0.09, - "bashMedianMs": 1.572, - "speedup": 17.3 + "bashMedianMs": 1.606, + "speedup": 17.9 }, { - "category": "arrays", - "description": "Indexed array reads, writes, expansion, and iteration.", + "category": "arithmetic", + "description": "Integer math, substitutions, and expression-heavy shell snippets.", "cases": 6, - "bashkitMedianMs": 0.098, - "bashMedianMs": 1.594, - "speedup": 16.4 + "bashkitMedianMs": 0.093, + "bashMedianMs": 1.645, + "speedup": 17.5 }, { - "category": "arithmetic", - "description": "Integer math, substitutions, and expression-heavy shell snippets.", + "category": "arrays", + "description": "Indexed array reads, writes, expansion, and iteration.", "cases": 6, - "bashkitMedianMs": 0.1, - "bashMedianMs": 1.527, - "speedup": 15.3 + "bashkitMedianMs": 0.102, + "bashMedianMs": 1.677, + "speedup": 16.6 }, { "category": "pipes", "description": "Pipeline construction, streaming, and command chaining.", "cases": 6, - "bashkitMedianMs": 0.113, - "bashMedianMs": 2.898, - "speedup": 19.6 + "bashkitMedianMs": 0.106, + "bashMedianMs": 3.073, + "speedup": 25.3 }, { "category": "control", "description": "Conditionals, loops, case statements, and branching scripts.", "cases": 9, - "bashkitMedianMs": 0.131, - "bashMedianMs": 1.56, - "speedup": 12.6 + "bashkitMedianMs": 0.118, + "bashMedianMs": 1.69, + "speedup": 15.1 }, { "category": "subshell", "description": "Command substitution and nested shell execution paths.", "cases": 6, - "bashkitMedianMs": 0.137, - "bashMedianMs": 3.345, - "speedup": 20.9 - }, - { - "category": "tools", - "description": "Builtin and external-tool style command workloads.", - "cases": 21, - "bashkitMedianMs": 0.144, - "bashMedianMs": 3.382, - "speedup": 22.7 + "bashkitMedianMs": 0.129, + "bashMedianMs": 2.755, + "speedup": 20.4 }, { "category": "io", "description": "File reads, writes, redirects, and filesystem-facing commands.", "cases": 6, - "bashkitMedianMs": 0.162, - "bashMedianMs": 2.826, - "speedup": 19.5 + "bashkitMedianMs": 0.145, + "bashMedianMs": 2.385, + "speedup": 18.4 + }, + { + "category": "tools", + "description": "Builtin and external-tool style command workloads.", + "cases": 21, + "bashkitMedianMs": 0.153, + "bashMedianMs": 3.91, + "speedup": 26.3 }, { "category": "complex", "description": "Mixed shell workflows that combine multiple language features.", "cases": 7, - "bashkitMedianMs": 0.165, - "bashMedianMs": 3.003, - "speedup": 10.9 + "bashkitMedianMs": 0.166, + "bashMedianMs": 3.132, + "speedup": 15 }, { "category": "large", "description": "Bigger scripts and higher-volume data paths.", "cases": 9, - "bashkitMedianMs": 1.838, - "bashMedianMs": 2.638, - "speedup": 3.2 + "bashkitMedianMs": 1.879, + "bashMedianMs": 3.074, + "speedup": 3.6 } ] }, @@ -2397,6 +2397,119 @@ "speedup": 3.2 } ] + }, + { + "id": "bench-1600ca61ae8a-linux-x86_64-1795653548", + "kind": "bashkit-bench", + "label": "1600ca61ae8a-linux-x86_64", + "date": "2026-11-26", + "timestamp": "2026-11-26T00:39:07.000Z", + "source": "crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json", + "reportSource": "crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.md", + "cases": 96, + "speedup": 14.3, + "bashkitMs": 63.21, + "bashMs": 906.89, + "errorRate": 0, + "matchRate": 100, + "categories": [ + { + "category": "startup", + "description": "Small commands where interpreter startup dominates runtime.", + "cases": 4, + "bashkitMedianMs": 0.078, + "bashMedianMs": 1.565, + "speedup": 20.5 + }, + { + "category": "strings", + "description": "String expansion, pattern handling, and text manipulation.", + "cases": 8, + "bashkitMedianMs": 0.089, + "bashMedianMs": 1.633, + "speedup": 18.4 + }, + { + "category": "variables", + "description": "Variable assignment, lookup, expansion, and environment handling.", + "cases": 8, + "bashkitMedianMs": 0.09, + "bashMedianMs": 1.606, + "speedup": 17.9 + }, + { + "category": "arithmetic", + "description": "Integer math, substitutions, and expression-heavy shell snippets.", + "cases": 6, + "bashkitMedianMs": 0.093, + "bashMedianMs": 1.645, + "speedup": 17.5 + }, + { + "category": "arrays", + "description": "Indexed array reads, writes, expansion, and iteration.", + "cases": 6, + "bashkitMedianMs": 0.102, + "bashMedianMs": 1.677, + "speedup": 16.6 + }, + { + "category": "pipes", + "description": "Pipeline construction, streaming, and command chaining.", + "cases": 6, + "bashkitMedianMs": 0.106, + "bashMedianMs": 3.073, + "speedup": 25.3 + }, + { + "category": "control", + "description": "Conditionals, loops, case statements, and branching scripts.", + "cases": 9, + "bashkitMedianMs": 0.118, + "bashMedianMs": 1.69, + "speedup": 15.1 + }, + { + "category": "subshell", + "description": "Command substitution and nested shell execution paths.", + "cases": 6, + "bashkitMedianMs": 0.129, + "bashMedianMs": 2.755, + "speedup": 20.4 + }, + { + "category": "io", + "description": "File reads, writes, redirects, and filesystem-facing commands.", + "cases": 6, + "bashkitMedianMs": 0.145, + "bashMedianMs": 2.385, + "speedup": 18.4 + }, + { + "category": "tools", + "description": "Builtin and external-tool style command workloads.", + "cases": 21, + "bashkitMedianMs": 0.153, + "bashMedianMs": 3.91, + "speedup": 26.3 + }, + { + "category": "complex", + "description": "Mixed shell workflows that combine multiple language features.", + "cases": 7, + "bashkitMedianMs": 0.166, + "bashMedianMs": 3.132, + "speedup": 15 + }, + { + "category": "large", + "description": "Bigger scripts and higher-volume data paths.", + "cases": 9, + "bashkitMedianMs": 1.879, + "bashMedianMs": 3.074, + "speedup": 3.6 + } + ] } ], "criterionRuns": [ @@ -3044,6 +3157,27 @@ "name": "`jq/object_copy_on_write`", "changePct": -2.6 } + }, + { + "id": "criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579", + "kind": "criterion", + "family": "parallel", + "label": "Criterion Parallel Execution Benchmark", + "date": "2026-11-26", + "timestamp": "2026-11-26T00:39:39.000Z", + "source": "crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md", + "reportSource": "crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md", + "cases": 33, + "medianUs": 8046.7, + "p95Us": 183642, + "medianChangePct": null, + "meanChangePct": null, + "bestChangePct": null, + "fastestCase": { + "name": "single_bash_new", + "us": 59.56 + }, + "bestImprovement": null } ], "evalRuns": [ @@ -10922,6 +11056,24 @@ "detail": "2.6% faster in `jq/object_copy_on_write`", "metric": 0.3, "source": "crates/bashkit/benches/results/criterion-jq-paired-linux-x86_64-1795651774.md" + }, + { + "date": "2026-11-26", + "timestamp": "2026-11-26T00:39:07.000Z", + "kind": "Benchmark", + "title": "14.3x faster than bash", + "detail": "96 parity/perf cases on 1600ca61ae8a-linux-x86_64; output match 100%.", + "metric": 14.3, + "source": "crates/bashkit-bench/results/bench-1600ca61ae8a-linux-x86_64-1795653548.json" + }, + { + "date": "2026-11-26", + "timestamp": "2026-11-26T00:39:39.000Z", + "kind": "Criterion", + "title": "parallel", + "detail": "single_bash_new at 59.56 us median", + "metric": 8046.7, + "source": "crates/bashkit/benches/results/criterion-parallel-1600ca61ae8a-linux-x86_64-1795653579.md" } ] } From c5914a259d155f5ed9593a9e686c4b80c9c9695f Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 19:06:53 -0600 Subject: [PATCH 09/12] test(jq): assert reader depth at owned boundaries --- .../bashkit/src/builtins/jq/jaq_json/read.rs | 18 ++++++++++++++++-- .../tests/integration/jq_value_depth_tests.rs | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/crates/bashkit/src/builtins/jq/jaq_json/read.rs b/crates/bashkit/src/builtins/jq/jaq_json/read.rs index 541af9902..f45234aaf 100644 --- a/crates/bashkit/src/builtins/jq/jaq_json/read.rs +++ b/crates/bashkit/src/builtins/jq/jaq_json/read.rs @@ -146,7 +146,15 @@ fn parse_at(next: u8, lexer: &mut L, depth: usize) -> Result(()) })?; #[cfg(feature = "experimental_jq")] - { super::Rc::new(arr) } + { + // Pin the reader's contextual depth invariant in test builds. + // Release builds avoid rescanning the completed value. + debug_assert!( + depth + arr.depth(super::ValueDepth::value_depth) + <= super::meter::MAX_VALUE_DEPTH + ); + super::Rc::new(arr) + } #[cfg(not(feature = "experimental_jq"))] super::metered(arr) }), @@ -167,7 +175,13 @@ fn parse_at(next: u8, lexer: &mut L, depth: usize) -> Result(()) })?; #[cfg(feature = "experimental_jq")] - return Ok(Val::Obj(super::Rc::new(obj))); + { + debug_assert!( + depth + obj.depth(super::ValueDepth::value_depth) + <= super::meter::MAX_VALUE_DEPTH + ); + return Ok(Val::Obj(super::Rc::new(obj))); + } #[cfg(not(feature = "experimental_jq"))] Val::obj(obj) }, diff --git a/crates/bashkit/tests/integration/jq_value_depth_tests.rs b/crates/bashkit/tests/integration/jq_value_depth_tests.rs index 0844d89f0..064c5fd5a 100644 --- a/crates/bashkit/tests/integration/jq_value_depth_tests.rs +++ b/crates/bashkit/tests/integration/jq_value_depth_tests.rs @@ -24,6 +24,19 @@ const CHILD: &str = "BASHKIT_JQ_VALUE_DEPTH_CHILD"; const DEPTH_ERROR: &str = "jq: error: value nesting depth limit (100) exceeded\n"; const TRAVERSAL_CHILD: &str = "BASHKIT_JQ_TRAVERSAL_CHILD"; +#[tokio::test] +async fn reader_accepts_exact_depth_limit() { + let mut bash = bashkit::Bash::new(); + for filter in [ + "(\"[\" * 100 + \"0\" + \"]\" * 100) | fromjson | length", + "(\"{\\\"a\\\":\" * 100 + \"0\" + \"}\" * 100) | fromjson | length", + ] { + let result = bash.exec(&format!("jq -n '{filter}'")).await.unwrap(); + assert_eq!(result.exit_code, 0, "{filter}: {}", result.stderr); + assert_eq!(result.stdout, "1\n", "{filter}"); + } +} + #[test] fn lifecycle_traversals_bounded() { bounded_child::run( @@ -154,7 +167,9 @@ const REVIEWED: &[(&str, &str)] = &[ ("jaq_json/mod.rs", "Rc::make_mut(&mut l).append(&r)?;"), ("jaq_json/mod.rs", "Rc::make_mut(&mut l).append(&r)?;"), ("jaq_json/mod.rs", "Rc::make_mut(&mut l).subtract(&r)?;"), - ("jaq_json/read.rs", "{ super::Rc::new(arr) }"), + // Reader attachments use checked push/insert; debug builds verify the + // completed container's contextual depth before these Rc constructions. + ("jaq_json/read.rs", "super::Rc::new(arr)"), ( "jaq_json/read.rs", "return Ok(Val::Obj(super::Rc::new(obj)));", From 8e8c5bc532f29989bbfcb4ee605d5488e9fe559b Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 19:07:31 -0600 Subject: [PATCH 10/12] ci(js): retain Deno coverage during canary outage --- .github/workflows/js.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index a825c4369..59dd34d9f 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -186,11 +186,27 @@ jobs: with: bun-version: ${{ matrix.version }} + # Deno's canary-latest.txt can briefly point to a missing binary. Keep + # exercising the binding against stable 2.x and report the fallback. + - name: Check Deno canary artifact + id: deno_canary + if: matrix.runtime == 'deno' && matrix.version == 'canary' + shell: bash + run: | + sha="$(curl -fsSL --retry 2 --max-time 15 https://dl.deno.land/canary-latest.txt || true)" + if [[ "$sha" =~ ^[0-9a-f]{40}$ ]] && curl -fsSI --retry 2 --max-time 15 -o /dev/null "https://dl.deno.land/canary/$sha/deno-x86_64-unknown-linux-gnu.zip"; then + echo "available=true" >> "$GITHUB_OUTPUT" + else + echo "available=false" >> "$GITHUB_OUTPUT" + echo "::warning::Deno canary artifact unavailable; testing stable 2.x instead" + echo "Deno canary artifact unavailable; this job tested stable 2.x instead." >> "$GITHUB_STEP_SUMMARY" + fi + - name: Setup Deno if: matrix.runtime == 'deno' uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2 with: - deno-version: ${{ matrix.version }} + deno-version: ${{ matrix.version == 'canary' && steps.deno_canary.outputs.available != 'true' && '2.x' || matrix.version }} - name: Install dependencies run: pnpm install --frozen-lockfile From 298d8675cdb41b1b6020ef4227b563863a220528 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 19:32:14 -0600 Subject: [PATCH 11/12] fix(jq): report polled stops on non-unwinding targets --- crates/bashkit/src/builtins/jq/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/bashkit/src/builtins/jq/mod.rs b/crates/bashkit/src/builtins/jq/mod.rs index c46cdb25b..ce70c8b27 100644 --- a/crates/bashkit/src/builtins/jq/mod.rs +++ b/crates/bashkit/src/builtins/jq/mod.rs @@ -342,16 +342,20 @@ async fn run_jq(ctx: Context<'_>, parsed: JqArgs<'_>) -> Result { #[cfg(feature = "experimental_jq")] let interruption = std::rc::Rc::new(std::cell::RefCell::new(None)); #[cfg(feature = "experimental_jq")] + let timed_out = std::rc::Rc::new(std::cell::Cell::new(false)); + #[cfg(feature = "experimental_jq")] let stop = { let deadline = deadline.clone(); let budget = ctx.execution_budget(); let interruption = interruption.clone(); + let timed_out = timed_out.clone(); Some(Box::new(move || { if deadline.as_ref().is_some_and(|deadline| { deadline .try_with(ExecutionDeadline::is_expired) .unwrap_or(true) }) { + timed_out.set(true); return true; } if let Some(budget) = &budget { @@ -668,6 +672,16 @@ async fn run_jq(ctx: Context<'_>, parsed: JqArgs<'_>) -> Result { if meter.tripped() { return size_error(&meter); } + // On panic=abort targets, the poll hook records a stop but cannot + // unwind. If evaluation later returns, report that stop here. + #[cfg(feature = "experimental_jq")] + if timed_out.get() { + return Ok(ExecResult::err("jq: execution timed out\n".to_string(), 5)); + } + #[cfg(feature = "experimental_jq")] + if let Some(error) = interruption.borrow_mut().take() { + return Err(error); + } if let Some(error) = input_error.into_inner() { return Err(error); } From 4ebe786a4db7d7d02be53798934d3779b445fac0 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Wed, 25 Nov 2026 19:35:08 -0600 Subject: [PATCH 12/12] test(jq): classify timeout marker in depth inventory --- crates/bashkit/tests/integration/jq_value_depth_tests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/bashkit/tests/integration/jq_value_depth_tests.rs b/crates/bashkit/tests/integration/jq_value_depth_tests.rs index 064c5fd5a..1960753e5 100644 --- a/crates/bashkit/tests/integration/jq_value_depth_tests.rs +++ b/crates/bashkit/tests/integration/jq_value_depth_tests.rs @@ -145,11 +145,15 @@ fn jq_sources(dir: &Path, out: &mut Vec) { const REVIEWED: &[(&str, &str)] = &[ // Object-wide updates collect into an already checked owned body. ("jaq_json/mod.rs", "return Ok(Self::Obj(Rc::new(body)));"), - // Per-run interruption reason, not value container storage. + // Per-run interruption state, not value container storage. ( "mod.rs", "let interruption = std::rc::Rc::new(std::cell::RefCell::new(None));", ), + ( + "mod.rs", + "let timed_out = std::rc::Rc::new(std::cell::Cell::new(false));", + ), // Experimental body admission. The owned type has no mutable dereference; // these callers can only invoke its checked attachment operations. ("jaq_json/mod.rs", "return Rc::new(Container::admit(body));"),