From 7cf9123327d8c58a84b3ecccad6b529ead38d6a7 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Mon, 23 Nov 2026 20:39:28 +0000 Subject: [PATCH 1/4] feat(interpreter): compile mixed control flow inside functions --- crates/bashkit/docs/compatibility.md | 17 +- crates/bashkit/docs/threat-model.md | 2 +- .../fuzz/fuzz_targets/script_plan_fuzz.rs | 38 +- .../src/interpreter/control_dispatch.rs | 695 ++++++++++++++++++ crates/bashkit/src/interpreter/mod.rs | 504 +------------ crates/bashkit/src/interpreter/script_plan.rs | 662 ++++++++++++++--- crates/bashkit/tests/integration/main.rs | 1 + .../tests/integration/mixed_control_tests.rs | 43 ++ .../tests/integration/time_command_tests.rs | 11 +- .../foundations/script-execution-plan.md | 43 +- knowledge/security/security-testing.md | 6 +- knowledge/security/threat-model.md | 2 +- 12 files changed, 1413 insertions(+), 611 deletions(-) create mode 100644 crates/bashkit/src/interpreter/control_dispatch.rs create mode 100644 crates/bashkit/tests/integration/mixed_control_tests.rs diff --git a/crates/bashkit/docs/compatibility.md b/crates/bashkit/docs/compatibility.md index 517b81126..8885b906b 100644 --- a/crates/bashkit/docs/compatibility.md +++ b/crates/bashkit/docs/compatibility.md @@ -25,12 +25,17 @@ cargo run -p bashkit-cli --features experimental_execution_plan -- \ Supported scalar arithmetic, numeric assignments, branches and loops can execute as flat instructions. Small one-shot scripts skip compilation. Unsupported -syntax, tool-containing compound bodies, word expansions, traps, tracing, -`errexit`, `nounset`, arrays and attributed variables use the ordinary -interpreter where required. A mixed script can use both paths. - -Plans belong to one execution and borrow its parsed source. They use the shared -request's work and memory budgets, command/iteration limits, cancellation and +leaves (including tools, pipelines, word expansions, regexes and arrays) use +the ordinary executor inside prepared function bodies and loop/branch control. +Arithmetic loop clauses recheck dynamic state before using compiled expressions; +traps, tracing, `errexit`, `nounset` and attributed variables retain ordinary +semantics. Redirected compound boundaries still use interpreter execution. +The `jq` builtin already compiles and reuses filters through its execution-local +LRU, including calls from planned loops; values and file contents stay dynamic. + +Plans belong to one execution or function invocation and borrow its parsed +source. They use the shared request's work and memory budgets, +command/iteration limits, cancellation and deadline checks. Compilation costs real work and memory, so tight budgets may reject earlier than the interpreter-only build. There is no shared compiler cache or persistent hotness state. diff --git a/crates/bashkit/docs/threat-model.md b/crates/bashkit/docs/threat-model.md index cb618c49c..d65d952e0 100644 --- a/crates/bashkit/docs/threat-model.md +++ b/crates/bashkit/docs/threat-model.md @@ -141,7 +141,7 @@ stdout capture limit remains downstream of pipelines and redirects. | Child-shell recursion (TM-DOS-125) | Script that re-runs itself via `sh` or `./s.sh` | Child shells count against function depth, max 8 nested | MITIGATED | | Re-entry recursion (TM-DOS-141) | `f(){ eval f; }`, `compgen -C`, `fc`, PROMPT_COMMAND re-entering the interpreter | Each re-entry counts against function depth, max 8 nested | MITIGATED | | Stack exhaustion from combined nesting (TM-DOS-142) | Nested compounds inside recursion inside `eval` overflow a 2 MiB worker stack | Command polls grow the stack on the heap when it runs low (`stacker`); depth caps bound the total | MITIGATED | -| Experimental compiled-region limit bypass (TM-DOS-147) | Optional compilation or execution skips resource checks or retains storage after cancellation | Execution-owned plans admit bounded storage, including vector growth, before allocation; native commands and loops retain shared limits and cancellation/deadline checks. Native fault-injection, reservation-refund and interrupted-execution tests plus differential fuzzing cover the backend | MITIGATED | +| Experimental compiled-region limit bypass (TM-DOS-147) | Optional compilation or execution skips resource checks or retains storage after cancellation | Execution/invocation-owned plans admit bounded storage and exact control-block capacities before allocation; function return/error/cancellation refunds plan storage. Shared orchestration preserves traps/routing/flow and compiled clauses recheck dynamic state; native commands and loops retain shared limits and cancellation/deadline checks. Native fault-injection, reservation-refund and interrupted-execution tests plus differential fuzzing cover the backend | MITIGATED | | Pattern substitution (TM-DOS-127) | `${x//*a*/b}` over a long value | Globs run as a size-capped linear-time regex; extglob search capped at 10,000 attempts | MITIGATED | | Unbounded builtin output (TM-DOS-058) | `seq 1 1000000` produces 1M lines | Add `max_stdout_bytes` limit | **MITIGATED** | | Silent truncation at builtin caps (TM-DOS-109) | `seq 200000`, an awk loop past its cap, or an oversized `sprintf` expression returns incomplete output with exit 0 | Caps report `: limit () exceeded` on stderr and exit non-zero; awk caps and formatting errors are fatal | **MITIGATED** | diff --git a/crates/bashkit/fuzz/fuzz_targets/script_plan_fuzz.rs b/crates/bashkit/fuzz/fuzz_targets/script_plan_fuzz.rs index 1da698cc3..cc72fd57f 100644 --- a/crates/bashkit/fuzz/fuzz_targets/script_plan_fuzz.rs +++ b/crates/bashkit/fuzz/fuzz_targets/script_plan_fuzz.rs @@ -27,23 +27,27 @@ fuzz_target!(|data: &[u8]| { .unwrap(); rt.block_on(async { bashkit::testing::fuzz_init(); - let mut results = Vec::new(); - for mode in [Mode::Auto, Mode::InterpreterOnly] { - let mut bash = Bash::new(); - let options = ExecOptions::new().extensions(ExecutionExtensions::new().with(mode)); - let result = bash.exec_with_options(&script, options).await.unwrap(); - bashkit::testing::assert_fuzz_invariants(&result, &script, "script_plan_fuzz", &[]); - results.push(( - result.stdout, - result.stderr, - result.exit_code, - result.control_flow, - )); - // Request-local plans/selectors must not corrupt subsequent use. - let next = bash.exec("printf reusable").await.unwrap(); - assert_eq!(next.stdout, "reusable"); - assert_eq!(next.exit_code, 0); + // Exercise both flat native regions and invocation-owned mixed + // function plans. Fixed shell syntax keeps arbitrary bytes as numeric + // operands; neither generated case can change the loop bound. + let mixed = format!( + r#"a=31; b=27; i=19; f() {{ local a b i observed; {}; }}; f; printf 'outer:%s,%s,%s\n' "$a" "$b" "$i""#, + script.replace("do if", r#"do observed=$(printf '%s' "$i"); [[ $observed =~ ^([0-9]+)$ ]] || return 7; ((BASH_REMATCH[1]==i)) || return 8; if"#) + ); + for script in [&script, &mixed] { + let mut results = Vec::new(); + for mode in [Mode::Auto, Mode::InterpreterOnly] { + let mut bash = Bash::new(); + let options = ExecOptions::new().extensions(ExecutionExtensions::new().with(mode)); + let result = bash.exec_with_options(script, options).await.unwrap(); + assert_eq!(result.exit_code, 0, "generated bounded script must finish: {script}\n{}", result.stderr); + bashkit::testing::assert_fuzz_invariants(&result, script, "script_plan_fuzz", &[]); + results.push((result.stdout, result.stderr, result.exit_code, result.control_flow)); + let next = bash.exec("printf reusable").await.unwrap(); + assert_eq!(next.stdout, "reusable"); + assert_eq!(next.exit_code, 0); + } + assert_eq!(results[0], results[1], "compiler/AST mismatch: {script}"); } - assert_eq!(results[0], results[1], "compiler/AST mismatch: {script}"); }); }); diff --git a/crates/bashkit/src/interpreter/control_dispatch.rs b/crates/bashkit/src/interpreter/control_dispatch.rs new file mode 100644 index 000000000..2ebb36f97 --- /dev/null +++ b/crates/bashkit/src/interpreter/control_dispatch.rs @@ -0,0 +1,695 @@ +//! One definition of shell orchestration for ordinary and prepared execution. +#[cfg(feature = "experimental_execution_plan")] +use super::*; + +macro_rules! control_body { + (plain, $shell:ident, $commands:expr, $index:expr) => { + $shell.execute_command_sequence($commands) + }; + (prepared, $shell:ident, $commands:expr, $index:expr, $prepared:ident) => { + $prepared.sequence($shell, $commands, $index, false) + }; +} +macro_rules! control_condition { + (plain, $shell:ident, $commands:expr, $index:expr) => { + $shell.execute_condition_sequence($commands) + }; + (prepared, $shell:ident, $commands:expr, $index:expr, $prepared:ident) => { + $prepared.sequence($shell, $commands, $index, true) + }; +} +macro_rules! control_clause { + (plain, $shell:ident, $source:expr, $index:expr, $writes:expr) => {{ + let text = $shell.arith_for_expr($source).await?; + if $writes { + $shell.execute_arithmetic_with_side_effects(&text) + } else { + $shell.evaluate_arithmetic(&text) + } + }}; + (prepared, $shell:ident, $source:expr, $index:expr, $writes:expr, $prepared:ident) => { + $shell + .evaluate_prepared_for_clause($source, $prepared.clause($index), $writes) + .await? + }; +} +macro_rules! control_compound { + (plain, $shell:ident, $compound:ident) => { + $shell.execute_compound($compound) + }; + (prepared, $shell:ident, $compound:ident, $prepared:ident) => { + $shell.execute_control_compound($compound, $prepared) + }; +} + +macro_rules! sequence_yield { + (plain, $shell:ident) => {}; + (prepared, $shell:ident) => { + if $shell.counters.commands > 0 + && $shell.counters.commands.is_multiple_of(64) + && $shell.execution_output().is_none() + { + crate::execution::yield_once().await; + } + }; +} + +macro_rules! sequence_body { + ($kind:ident, $shell:ident, $commands:ident, $check_errexit:ident $(, $prepared:ident)?) => {{ + let mut stdout = crate::StreamData::new(); + let mut stderr = crate::StreamData::new(); + let mut exit_code = 0; + let mut last_errexit_suppressed = false; + + for (_index, command) in $commands.iter().enumerate() { + sequence_yield!($kind, $shell); + let emit_before = $shell.output_emit_count; + $shell.sequence_accum = (stdout.len(), stderr.len()); + let mut result = list_command!($kind, $shell, command, _index $(, $prepared)?).await?; + if $shell.merge_stderr { + Self::merge_stderr_into_stdout(&mut result); + } + $shell.reap_coprocs(); + $shell.maybe_emit_output(&result.stdout, &result.stderr, emit_before) + .await?; + if $shell.retain_streamed_output() { + stdout.append(&result.stdout); + stderr.append(&result.stderr); + } + exit_code = result.exit_code; + $shell.last_exit_code = exit_code; + + // Propagate control flow + if result.control_flow != ControlFlow::None { + return Ok(ExecResult { + stdout, + stderr, + exit_code, + control_flow: result.control_flow, + ..Default::default() + }); + } + + // Check for errexit (set -e) if enabled. + // Suppression is decided by the callee and surfaced through + // result.errexit_suppressed (e.g. AND-OR lists). + let suppress = result.errexit_suppressed; + if $check_errexit && $shell.errexit_active() && exit_code != 0 && !suppress { + $shell.errexit_fired = true; + return Ok(ExecResult { + stdout, + stderr, + exit_code, + control_flow: ControlFlow::None, + ..Default::default() + }); + } + last_errexit_suppressed = suppress && exit_code != 0; + } + + Ok(ExecResult { + stdout, + stderr, + exit_code, + control_flow: ControlFlow::None, + errexit_suppressed: last_errexit_suppressed, + ..Default::default() + }) + }}; +} + +macro_rules! arithmetic_for_body { + ($kind:ident, $shell:ident, $arith_for:ident $(, $prepared:ident)?) => {{ + let mut acc = state::LoopAccumulator::new($shell.retain_streamed_output()); + // DEBUG output of the clauses (bash runs it before each one), put + // ahead of the next body's output or the loop's result. + let mut debug: Option> = None; + + // Execute initialization + if !$arith_for.init.is_empty() { + if $shell.has_debug_trap() { + $shell.current_line = $shell.line_at($arith_for.span.line()); + Self::absorb_debug(&mut debug, $shell.debug_trap_now().await); + if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { + return Ok(r); + } + } + control_clause!($kind, $shell, &$arith_for.init, 0, true $(, $prepared)?); + } + + $shell.counters.enter_loop(); + let result = async { + loop { + // Check loop iteration limit + $shell.counters.tick_loop(&$shell.limits)?; + + // Check condition (if empty, always true) + // The clauses see the `for` line, not the body's last one. + let for_line = $shell.line_at($arith_for.span.line()); + $shell.current_line = for_line; + if $shell.has_debug_trap() { + Self::absorb_debug(&mut debug, $shell.debug_trap_now().await); + if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { + return Ok(r); + } + } + if !$arith_for.condition.is_empty() { + let cond_result = control_clause!($kind, $shell, &$arith_for.condition, 1, false $(, $prepared)?); + if cond_result == 0 { + break; + } + } + + // Execute body + let emit_before = $shell.output_emit_count; + let result = control_body!($kind, $shell, &$arith_for.body, 0 $(, $prepared)?).await; + let result = DebugTrapOutput::prepend_opt(debug.take(), result)?; + $shell.maybe_emit_output(&result.stdout, &result.stderr, emit_before) + .await?; + let should_errexit = $shell.errexit_active() + && result.exit_code != 0 + && result.control_flow == ControlFlow::None + && !result.errexit_suppressed; + match acc.accumulate(result) { + state::LoopAction::None | state::LoopAction::Continue => { + if should_errexit { + return Ok(acc.finish()); + } + } + state::LoopAction::Break => break, + state::LoopAction::Exit(r) => return Ok(*r), + } + + // Execute step + if !$arith_for.step.is_empty() { + $shell.current_line = for_line; + if $shell.has_debug_trap() { + Self::absorb_debug(&mut debug, $shell.debug_trap_now().await); + if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { + return Ok(r); + } + } + control_clause!($kind, $shell, &$arith_for.step, 2, true $(, $prepared)?); + } + } + + Ok(acc.finish()) + } + .await; + $shell.counters.exit_loop(); + DebugTrapOutput::prepend_opt(debug, result) + }}; +} + +macro_rules! for_body { + ($kind:ident, $shell:ident, $for_cmd:ident $(, $prepared:ident)?) => {{ + // Validate for-loop variable name (bash rejects invalid names at runtime, exit 1) + if !is_valid_var_name(&$for_cmd.variable) { + return Ok(ExecResult::err( + $shell.diag(format!("`{}': not a valid identifier\n", $for_cmd.variable)), + 1, + )); + } + + let mut acc = state::LoopAccumulator::new($shell.retain_streamed_output()); + + // Get iteration values: expand fields, then apply brace/glob expansion + let values: Vec = if let Some(words) = &$for_cmd.words { + let mut vals = Vec::new(); + for w0 in words { + // Brace expansion runs first, on the unexpanded word. + let braced = $shell.brace_expand_word(w0); + for w in braced.as_deref().unwrap_or(std::slice::from_ref(w0)) { + let fields = $shell.expand_word_to_fields(w).await?; + + // Quoted words skip brace/glob expansion — unless the + // word has unquoted glob chars (e.g. `"$var"*.ext`) + if w.quoted && !w.has_unquoted_glob { + vals.extend(fields); + continue; + } + + for expanded in fields { + for item in [expanded] { + match $shell + .expand_glob_item(&item, w.quoted && w.has_unquoted_glob) + .await + { + Ok(items) => vals.extend(items), + Err(pat) => { + $shell.last_exit_code = 1; + return Ok(ExecResult::err( + $shell.diag(format!("no match: {pat}\n")), + 1, + )); + } + } + } + } + } + } + vals + } else { + // No words specified - iterate over positional parameters ($@) + $shell.call_stack + .last() + .map(|frame| frame.positional.clone()) + .unwrap_or_default() + }; + + $shell.counters.enter_loop(); + let result = async { + for value in values { + // Check loop iteration limit + $shell.counters.tick_loop(&$shell.limits)?; + + // Set loop variable (respects nameref). `value` is moved + // straight into `set_variable` — previously we cloned it + // even though `values` already owned the String for us. + // A nameref control variable is re-pointed at each word + // (bash: `declare -n r; for r in a b` binds r to a, then b). + if $shell.scoped.namerefs.contains_key(&$for_cmd.variable) + && declare::valid_nameref_target(&value) + { + $shell.set_nameref(&$for_cmd.variable, value); + } else { + $shell.set_variable($for_cmd.variable.clone(), value); + } + + // DEBUG runs for each round, at the `for` line. + let mut debug = if $shell.has_debug_trap() { + $shell.current_line = $shell.line_at($for_cmd.span.line()); + $shell.debug_trap_now().await + } else { + None + }; + if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { + return Ok(r); + } + + // Execute body + let emit_before = $shell.output_emit_count; + let result = control_body!($kind, $shell, &$for_cmd.body, 0 $(, $prepared)?).await; + let result = DebugTrapOutput::prepend_opt(debug, result)?; + $shell.maybe_emit_output(&result.stdout, &result.stderr, emit_before) + .await?; + let should_errexit = $shell.errexit_active() + && result.exit_code != 0 + && result.control_flow == ControlFlow::None + && !result.errexit_suppressed; + match acc.accumulate(result) { + state::LoopAction::None => { + if should_errexit { + return Ok(acc.finish()); + } + } + state::LoopAction::Break => break, + state::LoopAction::Continue => continue, + state::LoopAction::Exit(r) => return Ok(*r), + } + } + + Ok(acc.finish()) + } + .await; + $shell.counters.exit_loop(); + result + }}; +} + +macro_rules! condition_loop_body { + ($kind:ident, $shell:ident, $condition:ident, $body:ident, $break_on_zero:ident $(, $prepared:ident)?) => {{ + let mut acc = state::LoopAccumulator::new($shell.retain_streamed_output()); + + $shell.counters.enter_loop(); + let result = async { + loop { + // Check loop iteration limit + $shell.counters.tick_loop(&$shell.limits)?; + + // Check $condition (no errexit - conditions are expected to fail) + let emit_before_cond = $shell.output_emit_count; + let condition_result = control_condition!($kind, $shell, $condition, 0 $(, $prepared)?).await?; + // Condition commands produce visible output (e.g., `while cat < {} + state::LoopAction::Break => break, + state::LoopAction::Continue => continue, + state::LoopAction::Exit(r) => return Ok(*r), + } + } + let should_break = if $break_on_zero { + condition_result.exit_code == 0 + } else { + condition_result.exit_code != 0 + }; + if should_break { + break; + } + + // Execute $body + let emit_before = $shell.output_emit_count; + let result = control_body!($kind, $shell, $body, 1 $(, $prepared)?).await?; + $shell.maybe_emit_output(&result.stdout, &result.stderr, emit_before) + .await?; + let should_errexit = $shell.errexit_active() + && result.exit_code != 0 + && result.control_flow == ControlFlow::None + && !result.errexit_suppressed; + match acc.accumulate(result) { + state::LoopAction::None => { + if should_errexit { + return Ok(acc.finish()); + } + } + state::LoopAction::Break => break, + state::LoopAction::Continue => continue, + state::LoopAction::Exit(r) => return Ok(*r), + } + } + + Ok(acc.finish()) + } + .await; + $shell.counters.exit_loop(); + result + }}; +} + +macro_rules! if_body { + ($kind:ident, $shell:ident, $if_cmd:ident $(, $prepared:ident)?) => {{ + // Accumulate stdout/stderr from all condition evaluations + let mut cond_stdout = crate::StreamData::new(); + let mut cond_stderr = crate::StreamData::new(); + + // Execute condition (no errexit checking - conditions are expected to fail) + let condition_result = control_condition!($kind, $shell, &$if_cmd.condition, 0 $(, $prepared)?).await?; + cond_stdout.append(&condition_result.stdout); + cond_stderr.append(&condition_result.stderr); + // `exit`/`return`/`break` (or a fatal expansion error) inside the + // condition ends the `if` with that control flow. + if condition_result.control_flow != ControlFlow::None { + return Ok(ExecResult { + stdout: cond_stdout, + stderr: cond_stderr, + exit_code: condition_result.exit_code, + control_flow: condition_result.control_flow, + ..Default::default() + }); + } + + if condition_result.exit_code == 0 { + // Condition succeeded, execute then branch + let mut result = control_body!($kind, $shell, &$if_cmd.then_branch, 1 $(, $prepared)?).await?; + result.stdout = cond_stdout + &result.stdout; + result.stderr = cond_stderr + &result.stderr; + return Ok(result); + } + + // Check elif branches + for (_index, (elif_condition, elif_body)) in $if_cmd.elif_branches.iter().enumerate() { + let elif_result = control_condition!($kind, $shell, elif_condition, 2 + _index * 2 $(, $prepared)?).await?; + cond_stdout.append(&elif_result.stdout); + cond_stderr.append(&elif_result.stderr); + if elif_result.control_flow != ControlFlow::None { + return Ok(ExecResult { + stdout: cond_stdout, + stderr: cond_stderr, + exit_code: elif_result.exit_code, + control_flow: elif_result.control_flow, + ..Default::default() + }); + } + + if elif_result.exit_code == 0 { + let mut result = control_body!($kind, $shell, elif_body, 3 + _index * 2 $(, $prepared)?).await?; + result.stdout = cond_stdout + &result.stdout; + result.stderr = cond_stderr + &result.stderr; + return Ok(result); + } + } + + // Execute else branch if present + if let Some(else_branch) = &$if_cmd.else_branch { + let mut result = control_body!($kind, $shell, else_branch, 2 + $if_cmd.elif_branches.len() * 2 $(, $prepared)?).await?; + result.stdout = cond_stdout + &result.stdout; + result.stderr = cond_stderr + &result.stderr; + return Ok(result); + } + + // No branch executed, return condition output with success exit code + Ok(ExecResult { + stdout: cond_stdout, + stderr: cond_stderr, + exit_code: 0, + ..Default::default() + }) + }}; +} + +macro_rules! compound_redirect_body { + ($kind:ident, $shell:ident, $compound:ident, $redirects:ident $(, $prepared:ident)?) => {{ + Box::pin(async move { + let end_line = (!$redirects.is_empty()) + .then(|| Self::compound_end_line($compound)) + .flatten(); + if let Some(line) = end_line { + $shell.current_line = line; + } + // Process input redirections before executing $compound. + // WTF: a coproc fd as a $compound's stdin (`while read l; do + // ...; done <&${C[0]}`) is read to end of input up front, not + // line by line as the loop runs. + let stdin_setup = match $shell + .process_input_redirections(None, $redirects, StdinDemand::All, HighFdStdin::Any) + .await + { + Ok(s) => s, + Err(crate::error::Error::CommandFailure(msg)) => { + return Ok(ExecResult::err(msg, 1)); + } + Err(e) => return Err(e), + }; + // Keep stdin's byte/text storage admitted through the body. + let _stdin_storage = stdin_setup.stdin_lease; + let stdin = stdin_setup.stdin; + let prev_pipeline_stdin = if stdin.is_some() { + let prev = $shell.pipeline_stdin.take(); + $shell.pipeline_stdin = stdin; + Some(prev) + } else { + None + }; + + // Suspend output callback while output $redirects are active + // so that maybe_emit_output inside the $compound body does not + // leak output that will be redirected (e.g. `{ cmd; } 2>/dev/null`). + let region = $shell.enter_output_region($redirects); + + let has_dup_output = $redirects.iter().any(|r| r.kind == RedirectKind::DupOutput); + let has_file_redirect = $redirects.iter().any(|r| { + matches!( + r.kind, + RedirectKind::Output + | RedirectKind::Clobber + | RedirectKind::Append + | RedirectKind::OutputBoth + ) + }); + let capture_pending_fd = (has_dup_output && has_file_redirect) + || redirection::has_high_fd_file_redirect($redirects); + if capture_pending_fd { + if $shell.pending_fd_capture_depth == 0 { + $shell.clear_pending_fd_redirect_state(); + } + $shell.pending_fd_capture_depth += 1; + } + let result = control_compound!($kind, $shell, $compound $(, $prepared)?).await; + if capture_pending_fd { + $shell.pending_fd_capture_depth = $shell.pending_fd_capture_depth.saturating_sub(1); + if result.is_err() { + $shell.clear_pending_fd_redirect_state(); + } + } + // Restore callback before applying redirections + $shell.leave_output_region(region); + let result = result?; + + if let Some(prev) = prev_pipeline_stdin { + $shell.pipeline_stdin = prev; + } + if $redirects.is_empty() { + Ok(result) + } else { + if let Some(line) = end_line { + $shell.current_line = line; + } + $shell.apply_redirections(result, $redirects).await + } + }) + }}; +} + +#[cfg(feature = "experimental_execution_plan")] +impl Interpreter { + pub(super) async fn execute_prepared_sequence( + &mut self, + commands: &[Command], + condition: bool, + prepared: script_plan::PreparedCommands<'_, '_>, + ) -> Result { + self.condition_sequence_depth += usize::from(condition); + let check_errexit = !condition; + let result = + async { sequence_body!(prepared, self, commands, check_errexit, prepared) }.await; + self.condition_sequence_depth -= usize::from(condition); + result + } + + pub(super) fn execute_prepared_compound<'a>( + &'a mut self, + compound: &'a CompoundCommand, + redirects: &'a [Redirect], + prepared: script_plan::PreparedControl<'a, 'a>, + ) -> std::pin::Pin> + Send + 'a>> { + Box::pin(async move { + // Prepared compounds have no own redirects, but retain the same + // lexical fd-scope boundary as the ordinary compound wrapper. + let scope_len = self.fd_redirect_scope.len(); + let shell = &mut *self; + let result = + compound_redirect_body!(prepared, shell, compound, redirects, prepared).await; + self.fd_redirect_scope.truncate(scope_len); + result + }) + } + + pub(super) async fn execute_control_compound( + &mut self, + compound: &CompoundCommand, + prepared: script_plan::PreparedControl<'_, '_>, + ) -> Result { + let is_loop = matches!( + compound, + CompoundCommand::For(_) + | CompoundCommand::ArithmeticFor(_) + | CompoundCommand::While(_) + | CompoundCommand::Until(_) + ); + self.loop_depth += usize::from(is_loop); + let result = async { + match compound { + CompoundCommand::BraceGroup(commands) => { + prepared.sequence(self, commands, 0, false).await + } + CompoundCommand::For(for_cmd) => { + for_body!(prepared, self, for_cmd, prepared) + } + CompoundCommand::ArithmeticFor(arith_for) => { + arithmetic_for_body!(prepared, self, arith_for, prepared) + } + CompoundCommand::While(_) | CompoundCommand::Until(_) => { + let (condition, body, break_on_zero) = match compound { + CompoundCommand::While(w) => { + (w.condition.as_slice(), w.body.as_slice(), false) + } + CompoundCommand::Until(w) => { + (w.condition.as_slice(), w.body.as_slice(), true) + } + _ => unreachable!(), + }; + condition_loop_body!(prepared, self, condition, body, break_on_zero, prepared) + } + CompoundCommand::If(if_cmd) => { + if_body!(prepared, self, if_cmd, prepared) + } + _ => unreachable!("prepared compound kind"), + } + } + .await; + self.loop_depth -= usize::from(is_loop); + result + } + + pub(super) async fn evaluate_prepared_for_clause( + &mut self, + source: &str, + expression: Option<&arithmetic::program::Expression<'_>>, + writes: bool, + ) -> Result { + if let Some(expression) = expression + && script_plan::native_context(self) + && expression + .names() + .all(|name| script_plan::plain_variable(self, name)) + { + return Ok(match self.evaluate_program_expression(expression, writes) { + Ok(value) => value, + Err(message) => { + self.record_arith_error(message); + 0 + } + }); + } + let text = self.arith_for_expr(source).await?; + Ok(if writes { + self.execute_arithmetic_with_side_effects(&text) + } else { + self.evaluate_arithmetic(&text) + }) + } +} + +#[cfg(feature = "experimental_execution_plan")] +impl Interpreter { + #[inline] + pub(super) fn execution_plan_enabled(&self) -> bool { + #[cfg(feature = "experimental_plan_benchmark_control")] + return self + .current_execution_extensions() + .get::() + .and_then(|mode| { + mode.try_with(|mode| matches!(mode, crate::ExperimentalPlanBenchmarkControl::Auto)) + .ok() + }) + .unwrap_or(true); + #[cfg(not(feature = "experimental_plan_benchmark_control"))] + true + } + + pub(super) fn execute_planned_function_body<'a>( + &'a mut self, + body: &'a Command, + ) -> command_dispatch::CommandFuture<'a> { + // Tiny ordinary functions keep the original single boxed command + // future. Only profitable bodies allocate a compiler-owned frame. + let mut weight = 0; + if !self.execution_plan_enabled() || !script_plan::worthwhile(body, &mut weight, 0) { + return self.execute_command(body); + } + Box::pin(async move { + // The definition stays borrowed through this invocation. Errors + // return through the caller's normal function-frame cleanup. + let plan = script_plan::ScriptPlan::compile_commands( + std::slice::from_ref(body), + &self.execution_budget, + )?; + self.execute_command_with_program(body, plan.as_ref().and_then(|plan| plan.command(0))) + .await + }) + } +} diff --git a/crates/bashkit/src/interpreter/mod.rs b/crates/bashkit/src/interpreter/mod.rs index ccb725dbf..2d614ec57 100644 --- a/crates/bashkit/src/interpreter/mod.rs +++ b/crates/bashkit/src/interpreter/mod.rs @@ -44,6 +44,8 @@ mod arithmetic; #[macro_use] mod command_dispatch; +#[macro_use] +mod control_dispatch; mod brace_expansion; mod completion; mod coproc; @@ -4293,25 +4295,10 @@ impl Interpreter { fire_exit_hook: bool, ) -> Result { #[cfg(feature = "experimental_execution_plan")] - let plan = { - #[cfg(feature = "experimental_plan_benchmark_control")] - let enabled = self - .current_execution_extensions() - .get::() - .and_then(|mode| { - mode.try_with(|mode| { - matches!(mode, crate::ExperimentalPlanBenchmarkControl::Auto) - }) - .ok() - }) - .unwrap_or(true); - #[cfg(not(feature = "experimental_plan_benchmark_control"))] - let enabled = true; - if enabled { - script_plan::ScriptPlan::compile(script, &self.execution_budget)? - } else { - None - } + let plan = if self.execution_plan_enabled() { + script_plan::ScriptPlan::compile(script, &self.execution_budget)? + } else { + None }; let mut stdout = crate::StreamData::new(); let mut stderr = crate::StreamData::new(); @@ -5190,187 +5177,12 @@ impl Interpreter { /// Execute an if statement async fn execute_if(&mut self, if_cmd: &IfCommand) -> Result { - // Accumulate stdout/stderr from all condition evaluations - let mut cond_stdout = crate::StreamData::new(); - let mut cond_stderr = crate::StreamData::new(); - - // Execute condition (no errexit checking - conditions are expected to fail) - let condition_result = self.execute_condition_sequence(&if_cmd.condition).await?; - cond_stdout.append(&condition_result.stdout); - cond_stderr.append(&condition_result.stderr); - // `exit`/`return`/`break` (or a fatal expansion error) inside the - // condition ends the `if` with that control flow. - if condition_result.control_flow != ControlFlow::None { - return Ok(ExecResult { - stdout: cond_stdout, - stderr: cond_stderr, - exit_code: condition_result.exit_code, - control_flow: condition_result.control_flow, - ..Default::default() - }); - } - - if condition_result.exit_code == 0 { - // Condition succeeded, execute then branch - let mut result = self.execute_command_sequence(&if_cmd.then_branch).await?; - result.stdout = cond_stdout + &result.stdout; - result.stderr = cond_stderr + &result.stderr; - return Ok(result); - } - - // Check elif branches - for (elif_condition, elif_body) in &if_cmd.elif_branches { - let elif_result = self.execute_condition_sequence(elif_condition).await?; - cond_stdout.append(&elif_result.stdout); - cond_stderr.append(&elif_result.stderr); - if elif_result.control_flow != ControlFlow::None { - return Ok(ExecResult { - stdout: cond_stdout, - stderr: cond_stderr, - exit_code: elif_result.exit_code, - control_flow: elif_result.control_flow, - ..Default::default() - }); - } - - if elif_result.exit_code == 0 { - let mut result = self.execute_command_sequence(elif_body).await?; - result.stdout = cond_stdout + &result.stdout; - result.stderr = cond_stderr + &result.stderr; - return Ok(result); - } - } - - // Execute else branch if present - if let Some(else_branch) = &if_cmd.else_branch { - let mut result = self.execute_command_sequence(else_branch).await?; - result.stdout = cond_stdout + &result.stdout; - result.stderr = cond_stderr + &result.stderr; - return Ok(result); - } - - // No branch executed, return condition output with success exit code - Ok(ExecResult { - stdout: cond_stdout, - stderr: cond_stderr, - exit_code: 0, - ..Default::default() - }) + if_body!(plain, self, if_cmd) } /// Execute a for loop async fn execute_for(&mut self, for_cmd: &ForCommand) -> Result { - // Validate for-loop variable name (bash rejects invalid names at runtime, exit 1) - if !is_valid_var_name(&for_cmd.variable) { - return Ok(ExecResult::err( - self.diag(format!("`{}': not a valid identifier\n", for_cmd.variable)), - 1, - )); - } - - let mut acc = state::LoopAccumulator::new(self.retain_streamed_output()); - - // Get iteration values: expand fields, then apply brace/glob expansion - let values: Vec = if let Some(words) = &for_cmd.words { - let mut vals = Vec::new(); - for w0 in words { - // Brace expansion runs first, on the unexpanded word. - let braced = self.brace_expand_word(w0); - for w in braced.as_deref().unwrap_or(std::slice::from_ref(w0)) { - let fields = self.expand_word_to_fields(w).await?; - - // Quoted words skip brace/glob expansion — unless the - // word has unquoted glob chars (e.g. `"$var"*.ext`) - if w.quoted && !w.has_unquoted_glob { - vals.extend(fields); - continue; - } - - for expanded in fields { - for item in [expanded] { - match self - .expand_glob_item(&item, w.quoted && w.has_unquoted_glob) - .await - { - Ok(items) => vals.extend(items), - Err(pat) => { - self.last_exit_code = 1; - return Ok(ExecResult::err( - self.diag(format!("no match: {pat}\n")), - 1, - )); - } - } - } - } - } - } - vals - } else { - // No words specified - iterate over positional parameters ($@) - self.call_stack - .last() - .map(|frame| frame.positional.clone()) - .unwrap_or_default() - }; - - self.counters.enter_loop(); - let result = async { - for value in values { - // Check loop iteration limit - self.counters.tick_loop(&self.limits)?; - - // Set loop variable (respects nameref). `value` is moved - // straight into `set_variable` — previously we cloned it - // even though `values` already owned the String for us. - // A nameref control variable is re-pointed at each word - // (bash: `declare -n r; for r in a b` binds r to a, then b). - if self.scoped.namerefs.contains_key(&for_cmd.variable) - && declare::valid_nameref_target(&value) - { - self.set_nameref(&for_cmd.variable, value); - } else { - self.set_variable(for_cmd.variable.clone(), value); - } - - // DEBUG runs for each round, at the `for` line. - let mut debug = if self.has_debug_trap() { - self.current_line = self.line_at(for_cmd.span.line()); - self.debug_trap_now().await - } else { - None - }; - if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { - return Ok(r); - } - - // Execute body - let emit_before = self.output_emit_count; - let result = self.execute_command_sequence(&for_cmd.body).await; - let result = DebugTrapOutput::prepend_opt(debug, result)?; - self.maybe_emit_output(&result.stdout, &result.stderr, emit_before) - .await?; - let should_errexit = self.errexit_active() - && result.exit_code != 0 - && result.control_flow == ControlFlow::None - && !result.errexit_suppressed; - match acc.accumulate(result) { - state::LoopAction::None => { - if should_errexit { - return Ok(acc.finish()); - } - } - state::LoopAction::Break => break, - state::LoopAction::Continue => continue, - state::LoopAction::Exit(r) => return Ok(*r), - } - } - - Ok(acc.finish()) - } - .await; - self.counters.exit_loop(); - result + for_body!(plain, self, for_cmd) } /// Execute a select loop: select var in list; do body; done @@ -5639,87 +5451,7 @@ impl Interpreter { &mut self, arith_for: &ArithmeticForCommand, ) -> Result { - let mut acc = state::LoopAccumulator::new(self.retain_streamed_output()); - // DEBUG output of the clauses (bash runs it before each one), put - // ahead of the next body's output or the loop's result. - let mut debug: Option> = None; - - // Execute initialization - if !arith_for.init.is_empty() { - if self.has_debug_trap() { - self.current_line = self.line_at(arith_for.span.line()); - Self::absorb_debug(&mut debug, self.debug_trap_now().await); - if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { - return Ok(r); - } - } - let init = self.arith_for_expr(&arith_for.init).await?; - self.execute_arithmetic_with_side_effects(&init); - } - - self.counters.enter_loop(); - let result = async { - loop { - // Check loop iteration limit - self.counters.tick_loop(&self.limits)?; - - // Check condition (if empty, always true) - // The clauses see the `for` line, not the body's last one. - let for_line = self.line_at(arith_for.span.line()); - self.current_line = for_line; - if self.has_debug_trap() { - Self::absorb_debug(&mut debug, self.debug_trap_now().await); - if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { - return Ok(r); - } - } - if !arith_for.condition.is_empty() { - let condition = self.arith_for_expr(&arith_for.condition).await?; - let cond_result = self.evaluate_arithmetic(&condition); - if cond_result == 0 { - break; - } - } - - // Execute body - let emit_before = self.output_emit_count; - let result = self.execute_command_sequence(&arith_for.body).await; - let result = DebugTrapOutput::prepend_opt(debug.take(), result)?; - self.maybe_emit_output(&result.stdout, &result.stderr, emit_before) - .await?; - let should_errexit = self.errexit_active() - && result.exit_code != 0 - && result.control_flow == ControlFlow::None - && !result.errexit_suppressed; - match acc.accumulate(result) { - state::LoopAction::None | state::LoopAction::Continue => { - if should_errexit { - return Ok(acc.finish()); - } - } - state::LoopAction::Break => break, - state::LoopAction::Exit(r) => return Ok(*r), - } - - // Execute step - if !arith_for.step.is_empty() { - self.current_line = for_line; - if self.has_debug_trap() { - Self::absorb_debug(&mut debug, self.debug_trap_now().await); - if let Some(r) = DebugTrapOutput::exit_result(&mut debug) { - return Ok(r); - } - } - let step = self.arith_for_expr(&arith_for.step).await?; - self.execute_arithmetic_with_side_effects(&step); - } - } - - Ok(acc.finish()) - } - .await; - self.counters.exit_loop(); - DebugTrapOutput::prepend_opt(debug, result) + arithmetic_for_body!(plain, self, arith_for) } /// Add a DEBUG run's output to the pending one. @@ -6301,74 +6033,7 @@ impl Interpreter { body: &[Command], break_on_zero: bool, ) -> Result { - let mut acc = state::LoopAccumulator::new(self.retain_streamed_output()); - - self.counters.enter_loop(); - let result = async { - loop { - // Check loop iteration limit - self.counters.tick_loop(&self.limits)?; - - // Check condition (no errexit - conditions are expected to fail) - let emit_before_cond = self.output_emit_count; - let condition_result = self.execute_condition_sequence(condition).await?; - // Condition commands produce visible output (e.g., `while cat < {} - state::LoopAction::Break => break, - state::LoopAction::Continue => continue, - state::LoopAction::Exit(r) => return Ok(*r), - } - } - let should_break = if break_on_zero { - condition_result.exit_code == 0 - } else { - condition_result.exit_code != 0 - }; - if should_break { - break; - } - - // Execute body - let emit_before = self.output_emit_count; - let result = self.execute_command_sequence(body).await?; - self.maybe_emit_output(&result.stdout, &result.stderr, emit_before) - .await?; - let should_errexit = self.errexit_active() - && result.exit_code != 0 - && result.control_flow == ControlFlow::None - && !result.errexit_suppressed; - match acc.accumulate(result) { - state::LoopAction::None => { - if should_errexit { - return Ok(acc.finish()); - } - } - state::LoopAction::Break => break, - state::LoopAction::Continue => continue, - state::LoopAction::Exit(r) => return Ok(*r), - } - } - - Ok(acc.finish()) - } - .await; - self.counters.exit_loop(); - result + condition_loop_body!(plain, self, condition, body, break_on_zero) } /// Execute a case statement @@ -7697,64 +7362,7 @@ impl Interpreter { commands: &[Command], check_errexit: bool, ) -> Result { - let mut stdout = crate::StreamData::new(); - let mut stderr = crate::StreamData::new(); - let mut exit_code = 0; - let mut last_errexit_suppressed = false; - - for command in commands { - let emit_before = self.output_emit_count; - self.sequence_accum = (stdout.len(), stderr.len()); - let mut result = self.execute_command(command).await?; - if self.merge_stderr { - Self::merge_stderr_into_stdout(&mut result); - } - self.reap_coprocs(); - self.maybe_emit_output(&result.stdout, &result.stderr, emit_before) - .await?; - if self.retain_streamed_output() { - stdout.append(&result.stdout); - stderr.append(&result.stderr); - } - exit_code = result.exit_code; - self.last_exit_code = exit_code; - - // Propagate control flow - if result.control_flow != ControlFlow::None { - return Ok(ExecResult { - stdout, - stderr, - exit_code, - control_flow: result.control_flow, - ..Default::default() - }); - } - - // Check for errexit (set -e) if enabled. - // Suppression is decided by the callee and surfaced through - // result.errexit_suppressed (e.g. AND-OR lists). - let suppress = result.errexit_suppressed; - if check_errexit && self.errexit_active() && exit_code != 0 && !suppress { - self.errexit_fired = true; - return Ok(ExecResult { - stdout, - stderr, - exit_code, - control_flow: ControlFlow::None, - ..Default::default() - }); - } - last_errexit_suppressed = suppress && exit_code != 0; - } - - Ok(ExecResult { - stdout, - stderr, - exit_code, - control_flow: ControlFlow::None, - errexit_suppressed: last_errexit_suppressed, - ..Default::default() - }) + sequence_body!(plain, self, commands, check_errexit) } /// Execute a pipeline (cmd1 | cmd2 | cmd3) @@ -11440,10 +11048,13 @@ impl Interpreter { }; let mut result = match DebugTrapOutput::exit_result(&mut entry_debug) { Some(stop) => Ok(stop), - None => DebugTrapOutput::prepend_opt( - entry_debug, - self.execute_command(&func_def.body).await, - ), + None => { + #[cfg(feature = "experimental_execution_plan")] + let body = self.execute_planned_function_body(&func_def.body); + #[cfg(not(feature = "experimental_execution_plan"))] + let body = self.execute_command(&func_def.body); + DebugTrapOutput::prepend_opt(entry_debug, body.await) + } }; if let Ok(r) = &mut result { // Still in the function: the handler sees its locals. @@ -13042,84 +12653,7 @@ impl Interpreter { compound: &'a CompoundCommand, redirects: &'a [Redirect], ) -> std::pin::Pin> + Send + 'a>> { - Box::pin(async move { - let end_line = (!redirects.is_empty()) - .then(|| Self::compound_end_line(compound)) - .flatten(); - if let Some(line) = end_line { - self.current_line = line; - } - // Process input redirections before executing compound. - // WTF: a coproc fd as a compound's stdin (`while read l; do - // ...; done <&${C[0]}`) is read to end of input up front, not - // line by line as the loop runs. - let stdin_setup = match self - .process_input_redirections(None, redirects, StdinDemand::All, HighFdStdin::Any) - .await - { - Ok(s) => s, - Err(crate::error::Error::CommandFailure(msg)) => { - return Ok(ExecResult::err(msg, 1)); - } - Err(e) => return Err(e), - }; - // Keep stdin's byte/text storage admitted through the body. - let _stdin_storage = stdin_setup.stdin_lease; - let stdin = stdin_setup.stdin; - let prev_pipeline_stdin = if stdin.is_some() { - let prev = self.pipeline_stdin.take(); - self.pipeline_stdin = stdin; - Some(prev) - } else { - None - }; - - // Suspend output callback while output redirects are active - // so that maybe_emit_output inside the compound body does not - // leak output that will be redirected (e.g. `{ cmd; } 2>/dev/null`). - let region = self.enter_output_region(redirects); - - let has_dup_output = redirects.iter().any(|r| r.kind == RedirectKind::DupOutput); - let has_file_redirect = redirects.iter().any(|r| { - matches!( - r.kind, - RedirectKind::Output - | RedirectKind::Clobber - | RedirectKind::Append - | RedirectKind::OutputBoth - ) - }); - let capture_pending_fd = (has_dup_output && has_file_redirect) - || redirection::has_high_fd_file_redirect(redirects); - if capture_pending_fd { - if self.pending_fd_capture_depth == 0 { - self.clear_pending_fd_redirect_state(); - } - self.pending_fd_capture_depth += 1; - } - let result = self.execute_compound(compound).await; - if capture_pending_fd { - self.pending_fd_capture_depth = self.pending_fd_capture_depth.saturating_sub(1); - if result.is_err() { - self.clear_pending_fd_redirect_state(); - } - } - // Restore callback before applying redirections - self.leave_output_region(region); - let result = result?; - - if let Some(prev) = prev_pipeline_stdin { - self.pipeline_stdin = prev; - } - if redirects.is_empty() { - Ok(result) - } else { - if let Some(line) = end_line { - self.current_line = line; - } - self.apply_redirections(result, redirects).await - } - }) + compound_redirect_body!(plain, self, compound, redirects) } fn execute_cmd_subst<'a>( diff --git a/crates/bashkit/src/interpreter/script_plan.rs b/crates/bashkit/src/interpreter/script_plan.rs index e96d4df19..29aaf1c8e 100644 --- a/crates/bashkit/src/interpreter/script_plan.rs +++ b/crates/bashkit/src/interpreter/script_plan.rs @@ -1,7 +1,8 @@ //! Isolated whole-script execution-plan experiment (off by default). //! -//! THREAT[TM-DOS-147]: plans borrow one parsed Script, live only for that execution, and reserve -//! storage before lowering. Pure scalar command trees lower to a flat program. +//! THREAT[TM-DOS-147]: plans borrow a parsed Script or active function definition, +//! live only for that execution/invocation, and reserve storage before lowering. +//! Pure scalar command trees lower to a flat program. //! Mixed command lists keep the existing shell orchestration with prepared //! children. Unsupported syntax/state uses the ordinary interpreter. No global //! cache, pointer-keyed lookup, or new shell syntax is involved. @@ -16,12 +17,25 @@ pub(super) struct ScriptPlan<'s> { pub(super) enum Program<'s> { Native(NativeProgram), + Control(Box>), List { list: &'s CommandList, children: Vec>>, }, } +pub(super) struct ControlProgram<'s> { + compound: &'s CompoundCommand, + blocks: Vec>>>, + clauses: [Option>; 3], +} + +#[derive(Clone, Copy)] +pub(super) struct PreparedControl<'p, 's> { + program: &'p ControlProgram<'s>, + ops: &'p [Instruction<'s>], +} + pub(super) struct NativeProgram { range: std::ops::Range, } @@ -168,7 +182,7 @@ fn size(command: &Command, depth: usize) -> Option { // A small cold statement rarely recovers the cost of lowering it. The cheap // probe stays inline; full lowering is outlined away from ordinary tool calls. #[inline] -fn worthwhile(command: &Command, weight: &mut usize, depth: usize) -> bool { +pub(super) fn worthwhile(command: &Command, weight: &mut usize, depth: usize) -> bool { if depth > 64 { return false; } @@ -187,7 +201,27 @@ fn worthwhile(command: &Command, weight: &mut usize, depth: usize) -> bool { | CompoundCommand::Until(_), r, ) if r.is_empty() => { - return size(command, 0).is_some(); + return true; + } + Command::Compound(CompoundCommand::For(_), r) if r.is_empty() => { + return true; + } + Command::Compound(CompoundCommand::BraceGroup(body), r) if r.is_empty() => { + return body.iter().any(|c| worthwhile(c, weight, depth + 1)); + } + Command::Compound(CompoundCommand::If(branches), r) if r.is_empty() => { + return branches + .condition + .iter() + .chain(&branches.then_branch) + .chain( + branches + .elif_branches + .iter() + .flat_map(|(c, b)| c.iter().chain(b)), + ) + .chain(branches.else_branch.iter().flatten()) + .any(|c| worthwhile(c, weight, depth + 1)); } Command::Compound(_, _) => { if let Some(bytes) = size(command, 0) { @@ -210,26 +244,36 @@ impl<'s> ScriptPlan<'s> { pub fn compile( script: &'s Script, budget: &crate::limits::ExecutionBudget, + ) -> Result>> { + Self::compile_commands(&script.commands, budget) + } + + pub(super) fn compile_commands( + commands: &'s [Command], + budget: &crate::limits::ExecutionBudget, ) -> Result>> { let mut weight = 0; - if !script - .commands - .iter() - .any(|c| worthwhile(c, &mut weight, 0)) - { + if !commands.iter().any(|c| worthwhile(c, &mut weight, 0)) { return Ok(None); } - Self::lower_script(script, budget) + Self::lower_commands(commands, budget) } - #[cold] + #[cfg(test)] fn lower_script( script: &'s Script, budget: &crate::limits::ExecutionBudget, ) -> Result>> { - let capacity = script.commands.len().saturating_mul(4).clamp(8, 256); - let bytes = script - .commands + Self::lower_commands(&script.commands, budget) + } + + #[cold] + fn lower_commands( + input: &'s [Command], + budget: &crate::limits::ExecutionBudget, + ) -> Result>> { + let capacity = input.len().saturating_mul(4).clamp(8, 256); + let bytes = input .len() .saturating_mul(std::mem::size_of::>>()) .saturating_add(std::mem::size_of::()) @@ -248,8 +292,8 @@ impl<'s> ScriptPlan<'s> { }; // Keep capacity equal to the admitted command storage; collecting a // fallible iterator may otherwise grow geometrically past its length. - let mut commands = Vec::with_capacity(script.commands.len()); - for command in &script.commands { + let mut commands = Vec::with_capacity(input.len()); + for command in input { commands.push(Program::compile(command, &mut builder, 0)?); } if commands.iter().all(Option::is_none) { @@ -269,6 +313,142 @@ impl<'s> ScriptPlan<'s> { } } +impl<'s> ControlProgram<'s> { + fn compile( + compound: &'s CompoundCommand, + builder: &mut Builder<'_, 's>, + depth: usize, + ) -> Result>> { + if depth > 64 { + return Ok(None); + } + let (blocks, commands) = match compound { + CompoundCommand::BraceGroup(body) => (1, body.len()), + CompoundCommand::For(f) => (1, f.body.len()), + CompoundCommand::ArithmeticFor(f) => (1, f.body.len()), + CompoundCommand::While(w) => (2, w.condition.len().saturating_add(w.body.len())), + CompoundCommand::Until(w) => (2, w.condition.len().saturating_add(w.body.len())), + CompoundCommand::If(i) => ( + 3usize.saturating_add(i.elif_branches.len().saturating_mul(2)), + i.elif_branches.iter().fold( + i.condition + .len() + .saturating_add(i.then_branch.len()) + .saturating_add(i.else_branch.as_ref().map_or(0, Vec::len)), + |n, (c, b)| n.saturating_add(c.len()).saturating_add(b.len()), + ), + ), + _ => return Ok(None), + }; + // Admit every control node and exact child-vector capacity before + // allocating. Expressions use the tokenizer/operation layout bound. + if !builder.reserve( + std::mem::size_of::() + .saturating_add( + blocks.saturating_mul(std::mem::size_of::>>>()), + ) + .saturating_add( + commands.saturating_mul(std::mem::size_of::>>()), + ), + )? { + return Ok(None); + } + let mut program = Box::new(Self { + compound, + blocks: Vec::with_capacity(blocks), + clauses: [None, None, None], + }); + let mut add = |commands: &'s [Command]| -> Result<()> { + let mut children = Vec::with_capacity(commands.len()); + for command in commands { + children.push(Program::compile(command, builder, depth)?); + } + program.blocks.push(children); + Ok(()) + }; + match compound { + CompoundCommand::BraceGroup(body) => add(body)?, + CompoundCommand::For(f) => add(&f.body)?, + CompoundCommand::ArithmeticFor(f) => add(&f.body)?, + CompoundCommand::While(w) => { + add(&w.condition)?; + add(&w.body)?; + } + CompoundCommand::Until(w) => { + add(&w.condition)?; + add(&w.body)?; + } + CompoundCommand::If(i) => { + add(&i.condition)?; + add(&i.then_branch)?; + for (condition, body) in &i.elif_branches { + add(condition)?; + add(body)?; + } + add(i.else_branch.as_deref().unwrap_or(&[]))?; + } + _ => unreachable!(), + } + if let CompoundCommand::ArithmeticFor(f) = compound { + for (slot, source) in program + .clauses + .iter_mut() + .zip([&f.init, &f.condition, &f.step]) + { + if source.is_empty() || source.len() > 1024 { + continue; + } + builder.budget.consume_work(source.len() as u64)?; + if builder.reserve( + source + .len() + .saturating_mul(Expression::STORAGE_FACTOR) + .saturating_add(4096), + )? { + *slot = Expression::compile(source.as_str()); + } + } + } + if !matches!( + compound, + CompoundCommand::For(_) + | CompoundCommand::ArithmeticFor(_) + | CompoundCommand::While(_) + | CompoundCommand::Until(_) + ) && program.clauses.iter().all(Option::is_none) + && program.blocks.iter().flatten().all(Option::is_none) + { + return Ok(None); + } + Ok(Some(program)) + } +} + +impl<'p, 's> PreparedControl<'p, 's> { + pub(super) fn clause(&self, index: usize) -> Option<&Expression<'s>> { + self.program.clauses[index].as_ref() + } + + pub(super) async fn sequence( + self, + shell: &mut Interpreter, + commands: &[Command], + index: usize, + condition: bool, + ) -> Result { + shell + .execute_prepared_sequence( + commands, + condition, + PreparedCommands { + children: &self.program.blocks[index], + ops: self.ops, + }, + ) + .await + } +} + impl<'s> Program<'s> { fn compile( command: &'s Command, @@ -278,6 +458,7 @@ impl<'s> Program<'s> { if depth > 64 { return Ok(None); } + builder.budget.consume_work(1)?; if let Some(bytes) = size(command, 0) { builder.budget.consume_work(bytes as u64)?; let used = builder.used; @@ -299,6 +480,12 @@ impl<'s> Program<'s> { .saturating_mul(std::mem::size_of::>()), ); } + if let Command::Compound(compound, redirects) = command + && redirects.is_empty() + && let Some(control) = ControlProgram::compile(compound, builder, depth + 1)? + { + return Ok(Some(Self::Control(control))); + } if let Command::List(list) = command { if !builder.reserve( (list.rest.len() + 1).saturating_mul(std::mem::size_of::>>()), @@ -325,46 +512,54 @@ impl ProgramRef<'_, '_> { let Program::Native(program) = self.program else { return true; }; - // TODO(experiment): lower these contexts only after their boundary - // semantics have dedicated VM coverage. Fallback is a normal execution. - // Resource failpoints must exercise native fuel checks too. Only the - // command-boundary injector needs AST execution: its early status/error - // actions deliberately replace a whole shell command. This lookup is - // compiled out of production builds. - #[cfg(feature = "failpoints")] - if fail::list() - .iter() - .any(|(name, action)| name == "interp::execute_command" && action != "off") - { - return false; - } - if shell.is_errexit_enabled() - || shell.is_nounset() - || shell.is_xtrace_enabled() - || shell.flags.contains(BashFlags::NOEXEC) - || !shell.scoped.traps.is_empty() - || shell.pipe_out.is_some() - || !shell.subst_stderr.is_empty() - || shell.has_arith_unbound() - { - return false; - } - let plain = |name: &str| { - shell - .var_attrs_get(name) - .difference(VarAttrs::EXPORT) - .is_empty() - && !shell.scoped.arrays.contains_key(name) - && !shell.scoped.assoc_arrays.contains_key(name) - && shell.resolve_nameref(name) == name - && shell.lookup_regular_variable_ref(name).is_none_or(numeric) - }; - self.ops[program.range.clone()].iter().all(|op| match op { - Instruction::Arithmetic(e, _) => e.names().all(plain), - Instruction::Assign(s) => s.assignments.iter().all(|a| plain(&a.name)), - _ => true, - }) + native_context(shell) + && self.ops[program.range.clone()].iter().all(|op| match op { + Instruction::Arithmetic(e, _) => e.names().all(|name| plain_variable(shell, name)), + Instruction::Assign(s) => { + s.assignments.iter().all(|a| plain_variable(shell, &a.name)) + } + _ => true, + }) + } +} + +pub(super) fn native_context(shell: &Interpreter) -> bool { + // TODO(experiment): lower these contexts only after their boundary + // semantics have dedicated VM coverage. Fallback is a normal execution. + // Resource failpoints must exercise native fuel checks too. Only the + // command-boundary injector needs AST execution: its early status/error + // actions deliberately replace a whole shell command. This lookup is + // compiled out of production builds. + #[cfg(feature = "failpoints")] + if fail::list() + .iter() + .any(|(name, action)| name == "interp::execute_command" && action != "off") + { + return false; + } + if shell.is_errexit_enabled() + || shell.is_nounset() + || shell.is_xtrace_enabled() + || shell.flags.contains(BashFlags::NOEXEC) + || !shell.scoped.traps.is_empty() + || shell.pipe_out.is_some() + || !shell.subst_stderr.is_empty() + || shell.has_arith_unbound() + { + return false; } + true +} + +pub(super) fn plain_variable(shell: &Interpreter, name: &str) -> bool { + shell + .var_attrs_get(name) + .difference(VarAttrs::EXPORT) + .is_empty() + && !shell.scoped.arrays.contains_key(name) + && !shell.scoped.assoc_arrays.contains_key(name) + && shell.resolve_nameref(name) == name + && shell.lookup_regular_variable_ref(name).is_none_or(numeric) } fn expression<'s>( @@ -488,6 +683,21 @@ impl Interpreter { &mut self, program: ProgramRef<'_, '_>, ) -> Result { + if let Program::Control(control) = program.program { + let proc_sub_fds = self.proc_subs.open_count(); + let result = self + .execute_prepared_compound( + control.compound, + &[], + PreparedControl { + program: control, + ops: program.ops, + }, + ) + .await; + self.proc_subs.close_from(proc_sub_fds); + return result; + } let Program::Native(native) = program.program else { let Program::List { list, children } = program.program else { unreachable!() @@ -657,6 +867,280 @@ impl PreparedCommands<'_, '_> { mod tests { use super::*; + fn has_control(program: &Program<'_>) -> bool { + match program { + Program::Control(_) => true, + Program::List { children, .. } => children.iter().flatten().any(has_control), + Program::Native(_) => false, + } + } + + #[test] + fn mixed_tool_loop_keeps_a_compiled_plan() { + let interp = Interpreter::new(Arc::new(crate::InMemoryFs::new())); + let ast = Parser::new( + "for ((i=0;i<8;i++)); do reply=$(printf '%s' \"$i\"); [[ $reply == \"$i\" ]] || break; done", + ).parse().unwrap(); + let plan = ScriptPlan::compile(&ast, &interp.execution_budget).unwrap(); + assert!( + plan.is_some(), + "tool calls must not discard the surrounding compiled loop" + ); + } + + #[tokio::test] + async fn mixed_control_preserves_output_flow_and_command_accounting() { + for source in [ + "for ((i=0;i<5;i++)); do reply=$(printf '%s' \"$i\"); [[ $reply == \"$i\" ]] || break; printf '%s ' \"$reply\"; done", + "i=0; while ((i<4)); do ((i++)); printf '%s ' \"$i\"; done", + "i=0; until ((i==4)); do ((i++)); printf '%s ' \"$i\"; done", + "for i in 1 2 3; do ((total+=i)); printf '%s ' \"$total\"; done", + "for ((i=0;i<4;i++)); do if ((i==1)); then continue; elif ((i==3)); then break; else printf '%s ' \"$i\"; fi; done", + "if ((0)); then for ((i=0;i<3;i++)); do printf no; done; elif ((1)); then for ((i=0;i<2;i++)); do printf yes; done; else printf no; fi", + "for ((i=0;i<3;i++)); do for ((j=0;j<3;j++)); do printf '%s%s ' \"$i\" \"$j\"; break 2; done; done", + "for ((i=0;i<3;i++)); do printf '%s' \"$i\" | tr 0-9 a-j; done", + "for ((i=0;i<3;i++)); do printf x >&2; ((n+=1)); done", + "for ((i=0;i<3;i++)); do if ((i==1)); then set -u; fi; printf '%s' \"$i\"; done", + ] { + let ast = Parser::new(source).parse().unwrap(); + let mut expected = Interpreter::new(Arc::new(crate::InMemoryFs::new())); + let mut actual = Interpreter::new(Arc::new(crate::InMemoryFs::new())); + let plan = ScriptPlan::compile(&ast, &actual.execution_budget) + .unwrap() + .expect(source); + assert!( + plan.commands.iter().flatten().any(has_control), + "must prepare mixed control: {source}" + ); + for (index, command) in ast.commands.iter().enumerate() { + let before = expected.execute_command(command).await.unwrap(); + let after = actual + .execute_command_with_program(command, plan.command(index)) + .await + .unwrap(); + assert_eq!( + ( + before.stdout, + before.stderr, + before.exit_code, + before.control_flow, + before.errexit_suppressed + ), + ( + after.stdout, + after.stderr, + after.exit_code, + after.control_flow, + after.errexit_suppressed + ), + "{source}" + ); + } + for name in ["i", "j", "n", "total", "reply"] { + assert_eq!( + expected.lookup_regular_variable(name), + actual.lookup_regular_variable(name), + "{source}: {name}" + ); + } + assert_eq!( + expected.counters.commands, actual.counters.commands, + "{source}" + ); + assert_eq!( + expected.scoped.arrays.get("PIPESTATUS"), + actual.scoped.arrays.get("PIPESTATUS"), + "{source}" + ); + assert_eq!(actual.loop_depth, 0, "{source}"); + } + } + + #[cfg(feature = "experimental_plan_benchmark_control")] + #[tokio::test] + async fn planned_function_invocations_keep_fallback_semantics_and_redefinitions() { + use crate::{ + Bash, ExecOptions, ExecutionExtensions, ExperimentalPlanBenchmarkControl as Mode, + }; + for source in [ + "run() { local count=$1 reply; for ((i=0;i /tmp/out; cat /tmp/out", + "set -e; f() { for ((i=0;i<3;i++)); do printf x; false; printf no; done; }; f || printf caught", + "f() { local i; for ((i=0;i<3;i++)); do if ((i==1)); then declare -i i; fi; printf '%s' \"$i\"; done; }; f", + ] { + let mut results = Vec::new(); + let mut retained = Vec::new(); + for mode in [Mode::InterpreterOnly, Mode::Auto] { + let mut bash = Bash::new(); + let result = bash + .exec_with_options( + source, + ExecOptions::new().extensions(ExecutionExtensions::new().with(mode)), + ) + .await + .unwrap(); + results.push(( + result.stdout, + result.stderr, + result.exit_code, + result.control_flow, + )); + retained.push(bash.interpreter.execution_budget.live_bytes_for_test()); + assert_eq!( + bash.exec("printf reusable").await.unwrap().stdout, + "reusable" + ); + } + assert_eq!(results[0], results[1], "{source}"); + assert_eq!( + retained[0], retained[1], + "only ordinary retained shell state may outlive the plan: {source}" + ); + } + } + + #[cfg(feature = "experimental_plan_benchmark_control")] + #[tokio::test] + async fn function_plan_is_live_during_tools_and_refunded_after_return() { + use crate::{ + Bash, Builtin, BuiltinContext, ExecOptions, ExecutionExtensions, + ExperimentalPlanBenchmarkControl as Mode, + }; + use std::sync::atomic::{AtomicU64, Ordering}; + struct Observe(Arc); + #[crate::async_trait] + impl Builtin for Observe { + async fn execute(&self, ctx: BuiltinContext<'_>) -> crate::Result { + self.0.fetch_max( + ctx.execution_budget() + .unwrap() + .try_with(|budget| budget.live_bytes_for_test()) + .unwrap(), + Ordering::Relaxed, + ); + Ok(ExecResult::ok("")) + } + } + let mut peaks = Vec::new(); + let mut retained = Vec::new(); + for mode in [Mode::InterpreterOnly, Mode::Auto] { + let observed = Arc::new(AtomicU64::new(0)); + let mut bash = Bash::builder() + .builtin("observe", Box::new(Observe(observed.clone()))) + .build(); + bash.exec_with_options( + "f() { for ((i=0;i<3;i++)); do observe; done; }; f", + ExecOptions::new().extensions(ExecutionExtensions::new().with(mode)), + ) + .await + .unwrap(); + peaks.push(observed.load(Ordering::Relaxed)); + retained.push(bash.interpreter.execution_budget.live_bytes_for_test()); + } + assert!( + peaks[1] > peaks[0] + std::mem::size_of::>() as u64, + "function must enter its own admitted plan" + ); + assert_eq!( + retained[0], retained[1], + "invocation-owned storage must be refunded on return" + ); + } + + #[tokio::test] + async fn abandoning_a_mixed_function_refunds_its_compiler_storage() { + let mut bash = crate::Bash::new(); + bash.exec("f() { local i; for ((i=0;i<10000;i++)); do printf x; done; }") + .await + .unwrap(); + let before = bash.interpreter.execution_budget.live_bytes_for_test(); + let mut future = Box::pin(bash.exec("f")); + let mut context = std::task::Context::from_waker(std::task::Waker::noop()); + assert!(std::future::Future::poll(future.as_mut(), &mut context).is_pending()); + drop(future); + assert!( + bash.interpreter.execution_budget.live_bytes_for_test() <= before, + "abandoned invocation must release plan storage" + ); + assert_eq!( + bash.exec("printf reusable").await.unwrap().stdout, + "reusable" + ); + } + + #[tokio::test] + async fn cancellation_during_a_mixed_function_tool_releases_the_active_plan() { + struct Suspend(Arc>>); + #[crate::async_trait] + impl crate::Builtin for Suspend { + async fn execute(&self, ctx: crate::BuiltinContext<'_>) -> Result { + *self.0.lock().unwrap() = Some( + ctx.execution_budget() + .unwrap() + .try_with(Clone::clone) + .unwrap(), + ); + std::future::pending().await + } + } + let active_budget = Arc::new(StdMutex::new(None)); + let mut bash = crate::Bash::builder() + .builtin("suspend", Box::new(Suspend(active_budget.clone()))) + .build(); + bash.exec("f() { local i; for ((i=0;i<3;i++)); do suspend; done; }") + .await + .unwrap(); + let before = bash.interpreter.execution_budget.live_bytes_for_test(); + let mut future = Box::pin(bash.exec("f")); + let mut context = std::task::Context::from_waker(std::task::Waker::noop()); + assert!(std::future::Future::poll(future.as_mut(), &mut context).is_pending()); + // Bash replaces its budget at each exec boundary. Observe this + // request's budget inside the reached tool, rather than the old one. + let budget = active_budget.lock().unwrap().take().expect("tool reached"); + assert!( + budget.live_bytes_for_test() > before + std::mem::size_of::>() as u64 + ); + drop(future); + assert!( + budget.live_bytes_for_test() <= before, + "active plan storage refunded" + ); + assert_eq!( + bash.exec("printf reusable").await.unwrap().stdout, + "reusable" + ); + } + + #[cfg(all(feature = "jq", feature = "experimental_plan_benchmark_control"))] + #[tokio::test] + async fn mixed_function_jq_filters_keep_dynamic_bindings_and_file_contents() { + use crate::{ + Bash, ExecOptions, ExecutionExtensions, ExperimentalPlanBenchmarkControl as Mode, + }; + for source in [ + r#"f() { for ((i=0;i<4;i++)); do printf '{"n":2}' | jq -r --argjson scale "$i" '.n * $scale'; done; }; f"#, + r#"f() { for ((i=0;i<3;i++)); do printf '.a + %s' "$i" > /tmp/filter; printf '{"a":2}' | jq -f /tmp/filter; done; }; f"#, + r#"f() { for ((i=0;i<3;i++)); do if ((i>100)); then jq -n 'bad('; fi; printf yes; done; }; f"#, + r#"f() { for ((i=0;i<2;i++)); do jq -n '42'; done; }; jq() { printf shadowed; }; f"#, + ] { + let mut results = Vec::new(); + for mode in [Mode::InterpreterOnly, Mode::Auto] { + let mut bash = Bash::new(); + let r = bash + .exec_with_options( + source, + ExecOptions::new().extensions(ExecutionExtensions::new().with(mode)), + ) + .await + .unwrap(); + results.push((r.stdout, r.stderr, r.exit_code, r.control_flow)); + } + assert_eq!(results[0], results[1], "{source}"); + } + } + #[test] fn numeric_admission_requires_a_literal_instead_of_unary_expressions() { for value in ["++1", "--1", "-+2", "+-2", "+ 2"] { @@ -717,22 +1201,25 @@ mod tests { #[test] fn declined_and_failed_compilation_refund_storage() { - let ast = Parser::new("for ((i=0;i<3;i++)); do ((a+=i)); done") - .parse() - .unwrap(); - for (limits, work_error) in [ - (ExecutionLimits::new().max_live_intermediate_bytes(1), false), - (ExecutionLimits::new().max_work_units(1), true), + for source in [ + "for ((i=0;i<3;i++)); do ((a+=i)); done", + "for ((i=0;i<3;i++)); do reply=$(printf '%s' \"$i\"); printf '%s' \"$reply\"; done", ] { - let budget = - crate::limits::ExecutionBudget::new(&limits, Arc::new(AtomicBool::new(false))); - let result = ScriptPlan::compile(&ast, &budget); - if work_error { - assert!(result.is_err()); - } else { - assert!(result.unwrap().is_none()); + let ast = Parser::new(source).parse().unwrap(); + for (limits, work_error) in [ + (ExecutionLimits::new().max_live_intermediate_bytes(1), false), + (ExecutionLimits::new().max_work_units(1), true), + ] { + let budget = + crate::limits::ExecutionBudget::new(&limits, Arc::new(AtomicBool::new(false))); + let result = ScriptPlan::compile(&ast, &budget); + if work_error { + assert!(result.is_err(), "{source}"); + } else { + assert!(result.unwrap().is_none(), "{source}"); + } + assert_eq!(budget.live_bytes_for_test(), 0, "{source}"); } - assert_eq!(budget.live_bytes_for_test(), 0); } } @@ -935,24 +1422,27 @@ mod tests { } #[tokio::test] - async fn budget_errors_restore_native_loop_scopes() { - let ast = Parser::new("for ((i=0;i<100;i++)); do ((a+=i)); done") - .parse() - .unwrap(); - for limits in [ - ExecutionLimits::new().max_commands(5), - ExecutionLimits::new().max_loop_iterations(5), + async fn budget_errors_restore_prepared_loop_scopes() { + for source in [ + "for ((i=0;i<100;i++)); do ((a+=i)); done", + "for ((i=0;i<100;i++)); do printf x; done", ] { - let mut interp = Interpreter::new(Arc::new(crate::InMemoryFs::new())); - interp.limits = limits; - let plan = ScriptPlan::lower_script(&ast, &interp.execution_budget) - .unwrap() - .unwrap(); - let result = interp - .execute_command_with_program(&ast.commands[0], plan.command(0)) - .await; - assert!(result.is_err()); - assert_eq!(interp.loop_depth, 0); + let ast = Parser::new(source).parse().unwrap(); + for limits in [ + ExecutionLimits::new().max_commands(5), + ExecutionLimits::new().max_loop_iterations(5), + ] { + let mut interp = Interpreter::new(Arc::new(crate::InMemoryFs::new())); + interp.limits = limits; + let plan = ScriptPlan::lower_script(&ast, &interp.execution_budget) + .unwrap() + .unwrap(); + let result = interp + .execute_command_with_program(&ast.commands[0], plan.command(0)) + .await; + assert!(result.is_err(), "{source}"); + assert_eq!(interp.loop_depth, 0, "{source}"); + } } } diff --git a/crates/bashkit/tests/integration/main.rs b/crates/bashkit/tests/integration/main.rs index 5576f4d1e..b81411c93 100644 --- a/crates/bashkit/tests/integration/main.rs +++ b/crates/bashkit/tests/integration/main.rs @@ -64,6 +64,7 @@ pub mod interactive_builtins_tests; pub mod make_substitution_tests; pub mod markkit_builtin_tests; pub mod memory_growth_security_tests; +pub mod mixed_control_tests; pub mod output_file_tests; pub mod streaming_command_tests; pub mod tar_files_from_budget_tests; diff --git a/crates/bashkit/tests/integration/mixed_control_tests.rs b/crates/bashkit/tests/integration/mixed_control_tests.rs new file mode 100644 index 000000000..270f92959 --- /dev/null +++ b/crates/bashkit/tests/integration/mixed_control_tests.rs @@ -0,0 +1,43 @@ +use bashkit::Bash; + +#[tokio::test] +#[cfg_attr(not(unix), ignore = "compares against host Unix bash")] +async fn mixed_functions_and_loops_match_bash() { + for source in [ + // The original tool benchmark's JSON/substitution/regex shape, using + // a shell fixture so exactly the same script runs in both engines. + r#"call_tool() { printf '{"id":%s,"ok":true}\n' "$1"; } +run() { + local start=$1 count=$2 id reply + local end=$((start + count)) + for ((id=start;id Date: Mon, 23 Nov 2026 20:57:15 +0000 Subject: [PATCH 2/4] fix(interpreter): keep wholly opaque loops on synchronous fallback --- crates/bashkit/src/interpreter/script_plan.rs | 34 +++++++++++++++---- .../foundations/script-execution-plan.md | 2 ++ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/crates/bashkit/src/interpreter/script_plan.rs b/crates/bashkit/src/interpreter/script_plan.rs index 29aaf1c8e..427ff6525 100644 --- a/crates/bashkit/src/interpreter/script_plan.rs +++ b/crates/bashkit/src/interpreter/script_plan.rs @@ -409,13 +409,10 @@ impl<'s> ControlProgram<'s> { } } } - if !matches!( - compound, - CompoundCommand::For(_) - | CompoundCommand::ArithmeticFor(_) - | CompoundCommand::While(_) - | CompoundCommand::Until(_) - ) && program.clauses.iter().all(Option::is_none) + // An opaque loop has no compiled work to amortize the prepared + // dispatcher. Keep its ordinary execution (including synchronous + // limit reporting) instead of introducing extra yield points. + if program.clauses.iter().all(Option::is_none) && program.blocks.iter().flatten().all(Option::is_none) { return Ok(None); @@ -888,6 +885,29 @@ mod tests { ); } + #[tokio::test] + async fn opaque_loops_keep_synchronous_limit_reporting() { + let source = "while true; do :; done"; + let ast = Parser::new(source).parse().unwrap(); + let mut bash = crate::Bash::builder() + .limits(ExecutionLimits::new().max_loop_iterations(100)) + .build(); + assert!( + ScriptPlan::compile(&ast, &bash.interpreter.execution_budget) + .unwrap() + .is_none(), + "a wholly opaque loop must decline preparation" + ); + let mut future = Box::pin(bash.exec(source)); + let mut context = std::task::Context::from_waker(std::task::Waker::noop()); + assert!(matches!( + std::future::Future::poll(future.as_mut(), &mut context), + std::task::Poll::Ready(Err(crate::Error::ResourceLimit( + crate::LimitExceeded::MaxLoopIterations(100) + ))) + )); + } + #[tokio::test] async fn mixed_control_preserves_output_flow_and_command_accounting() { for source in [ diff --git a/knowledge/foundations/script-execution-plan.md b/knowledge/foundations/script-execution-plan.md index a1dded5b2..34af1e8e6 100644 --- a/knowledge/foundations/script-execution-plan.md +++ b/knowledge/foundations/script-execution-plan.md @@ -52,6 +52,8 @@ as ordinary execution. Individual unsupported leaves (tools, pipelines, substitutions, regexes and arrays) retain their existing executor. Safe arithmetic `for` clauses are compiled independently and recheck variable attributes, values and dynamic shell state before each evaluation. +Controls with no compiled child or clause retain ordinary execution, preserving +synchronous limit reporting and avoiding an empty prepared dispatcher. Profitable function bodies receive a fresh invocation-owned plan after entering the normal call frame. Small functions retain the ordinary boxed command future. From 9cab5a45e22f6cf9dc8f6322078ae6087cd935a1 Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Mon, 23 Nov 2026 22:11:04 +0000 Subject: [PATCH 3/4] perf(wasm): reduce optional compiler bundle and add reproducible probes --- .github/dependabot.yml | 18 + .../__test__/bashkit-wasm.test.mjs | 10 + crates/bashkit-wasm/scripts/build.sh | 13 + crates/bashkit/docs/compatibility.md | 2 + .../src/interpreter/arithmetic/program.rs | 12 +- crates/bashkit/src/interpreter/script_plan.rs | 9 +- experiments/mixed-execution-plan/Cargo.lock | 1696 +++++++++++++++++ experiments/mixed-execution-plan/Cargo.toml | 14 + .../original-adapter.lock | 1492 +++++++++++++++ .../mixed-execution-plan/original-adapter.rs | 232 +++ .../reproduce-original.py | 97 + experiments/mixed-execution-plan/src/main.rs | 155 ++ .../foundations/script-execution-plan.md | 2 + knowledge/runtimes/browser-package.md | 6 + 14 files changed, 3751 insertions(+), 7 deletions(-) create mode 100644 experiments/mixed-execution-plan/Cargo.lock create mode 100644 experiments/mixed-execution-plan/Cargo.toml create mode 100644 experiments/mixed-execution-plan/original-adapter.lock create mode 100644 experiments/mixed-execution-plan/original-adapter.rs create mode 100644 experiments/mixed-execution-plan/reproduce-original.py create mode 100644 experiments/mixed-execution-plan/src/main.rs diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1c45302f7..79924e1c3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -218,6 +218,24 @@ updates: # job. Keep its Wasmtime release series in step with the root workspace. - dependency-name: "wasmtime" + # The compiler experiment resolves its own locked benchmark dependencies. + # Published measurements retain the lockfile from their recorded commit. + - package-ecosystem: "cargo" + directory: "/experiments/mixed-execution-plan" + schedule: + interval: "weekly" + commit-message: + prefix: "chore(deps)" + allow: + - dependency-name: "tokio" + - dependency-name: "serde_json" + groups: + compiler-benchmark-dependencies: + patterns: + - "*" + ignore: + - dependency-name: "wasmtime" + # npm / pnpm. # # Important decision: the five pnpm lockfiles in this repo had no diff --git a/crates/bashkit-wasm/__test__/bashkit-wasm.test.mjs b/crates/bashkit-wasm/__test__/bashkit-wasm.test.mjs index 7179f4e3d..96563efd1 100644 --- a/crates/bashkit-wasm/__test__/bashkit-wasm.test.mjs +++ b/crates/bashkit-wasm/__test__/bashkit-wasm.test.mjs @@ -240,6 +240,16 @@ test("options: maxLoopIterations bounds runaway loops", () => { ); }); +test("sync: word iteration stays synchronous with arithmetic in its body", () => { + const bash = new Bash(); + const result = bash.executeSync( + "total=0; for i in {1..100}; do ((total+=i)); done; printf '%s\\n' \"$total\"", + ); + assert.equal(result.stdout, "5050\n"); + assert.equal(result.stderr, ""); + assert.equal(result.exitCode, 0); +}); + test("output is capped and reports truncation", () => { const bash = new Bash(); const r = bash.executeSync(`printf '${"x".repeat(1_100_000)}'`); diff --git a/crates/bashkit-wasm/scripts/build.sh b/crates/bashkit-wasm/scripts/build.sh index ed0ef4dba..f8dd2a6a6 100755 --- a/crates/bashkit-wasm/scripts/build.sh +++ b/crates/bashkit-wasm/scripts/build.sh @@ -54,6 +54,19 @@ if command -v wasm-opt >/dev/null 2>&1; then --enable-nontrapping-float-to-int \ --enable-sign-ext \ "$OUT_DIR/bashkit_wasm_bg.wasm" -o "$OUT_DIR/bashkit_wasm_bg.wasm" + case ",$FEATURES," in + *,experimental_execution_plan,*|*,bashkit/experimental_execution_plan,*) + # The mixed compiler adds async control-flow state machines. Reconstruct + # their branches before converging size optimization; keep the ordinary + # package's measured code-generation policy unchanged. + echo "==> wasm-opt --flatten --rereloop -Oz --converge (execution plan)" + wasm-opt --flatten --rereloop -Oz --converge \ + --enable-bulk-memory \ + --enable-nontrapping-float-to-int \ + --enable-sign-ext \ + "$OUT_DIR/bashkit_wasm_bg.wasm" -o "$OUT_DIR/bashkit_wasm_bg.wasm" + ;; + esac else WASM_OPT_VERSION=none echo "==> wasm-opt not found; skipping size optimization" diff --git a/crates/bashkit/docs/compatibility.md b/crates/bashkit/docs/compatibility.md index 8885b906b..45411867e 100644 --- a/crates/bashkit/docs/compatibility.md +++ b/crates/bashkit/docs/compatibility.md @@ -32,6 +32,8 @@ traps, tracing, `errexit`, `nounset` and attributed variables retain ordinary semantics. Redirected compound boundaries still use interpreter execution. The `jq` builtin already compiles and reuses filters through its execution-local LRU, including calls from planned loops; values and file contents stay dynamic. +Compiled regions yield cooperatively. Browser callers running longer compiled +scripts should use `execute()`; `executeSync()` rejects suspended executions. Plans belong to one execution or function invocation and borrow its parsed source. They use the shared request's work and memory budgets, diff --git a/crates/bashkit/src/interpreter/arithmetic/program.rs b/crates/bashkit/src/interpreter/arithmetic/program.rs index 8ee757c9e..f20f664ba 100644 --- a/crates/bashkit/src/interpreter/arithmetic/program.rs +++ b/crates/bashkit/src/interpreter/arithmetic/program.rs @@ -132,8 +132,10 @@ impl<'s> Expression<'s> { pub const STORAGE_FACTOR: usize = 2 * std::mem::size_of::<(Tok, usize)>() + 4 * std::mem::size_of::() + 4; - pub fn compile(source: impl Into>) -> Option { - let source = source.into(); + // Mixed clauses and flat regions share one compiler body. Normalize the + // source before this boundary instead of instantiating it for &str and Cow. + #[inline(never)] + pub fn compile(source: std::borrow::Cow<'s, str>) -> Option { if source.len() > 1024 || source.contains(['$', '"', '`']) { return None; } @@ -273,7 +275,7 @@ mod tests { let tokens = tokenize(&source).unwrap(); let token_storage = tokens.capacity() * std::mem::size_of::<(Tok, usize)>(); drop(tokens); - let expression = Expression::compile(source.as_str()); + let expression = Expression::compile(source.as_str().into()); let op_storage = expression .as_ref() .map_or(0, |e| e.ops.capacity() * std::mem::size_of::()); @@ -306,7 +308,7 @@ mod tests { a.set_variable("x".into(), value.into()); b.set_variable("x".into(), value.into()); let expected = a.try_evaluate_arithmetic_with_assign(source); - let expr = Expression::compile(source).unwrap(); + let expr = Expression::compile(source.into()).unwrap(); let actual = b.evaluate_program_expression(&expr, true); assert_eq!(actual, expected, "{source}, x={value}"); assert_eq!( @@ -329,7 +331,7 @@ mod tests { "08", "x<$(echo 4)", ] { - assert!(Expression::compile(source).is_none(), "{source}"); + assert!(Expression::compile(source.into()).is_none(), "{source}"); } } } diff --git a/crates/bashkit/src/interpreter/script_plan.rs b/crates/bashkit/src/interpreter/script_plan.rs index 427ff6525..68524fcb4 100644 --- a/crates/bashkit/src/interpreter/script_plan.rs +++ b/crates/bashkit/src/interpreter/script_plan.rs @@ -181,7 +181,8 @@ fn size(command: &Command, depth: usize) -> Option { // A small cold statement rarely recovers the cost of lowering it. The cheap // probe stays inline; full lowering is outlined away from ordinary tool calls. -#[inline] +#[cfg_attr(not(target_arch = "wasm32"), inline)] +#[cfg_attr(target_arch = "wasm32", inline(never))] pub(super) fn worthwhile(command: &Command, weight: &mut usize, depth: usize) -> bool { if depth > 64 { return false; @@ -314,6 +315,7 @@ impl<'s> ScriptPlan<'s> { } impl<'s> ControlProgram<'s> { + #[cfg_attr(target_arch = "wasm32", inline(never))] fn compile( compound: &'s CompoundCommand, builder: &mut Builder<'_, 's>, @@ -405,7 +407,7 @@ impl<'s> ControlProgram<'s> { .saturating_mul(Expression::STORAGE_FACTOR) .saturating_add(4096), )? { - *slot = Expression::compile(source.as_str()); + *slot = Expression::compile(source.as_str().into()); } } } @@ -447,6 +449,7 @@ impl<'p, 's> PreparedControl<'p, 's> { } impl<'s> Program<'s> { + #[cfg_attr(target_arch = "wasm32", inline(never))] fn compile( command: &'s Command, builder: &mut Builder<'_, 's>, @@ -989,6 +992,8 @@ mod tests { "f() { local i; for ((i=0;i<3;i++)); do printf '%s:%s ' \"${FUNCNAME[0]}\" \"$LINENO\"; done; }; f > /tmp/out; cat /tmp/out", "set -e; f() { for ((i=0;i<3;i++)); do printf x; false; printf no; done; }; f || printf caught", "f() { local i; for ((i=0;i<3;i++)); do if ((i==1)); then declare -i i; fi; printf '%s' \"$i\"; done; }; f", + r#"f() { local n=0 line; while read -r line; do ((n+=1)); printf '%s:%s\n' "$n" "$line"; done; }; printf 'a\nb\n' | f"#, + r#"f() { local i line; for ((i=0;i<2;i++)); do read -r line; printf '%s' "$line"; done; }; f <<< $'a\nb'"#, ] { let mut results = Vec::new(); let mut retained = Vec::new(); diff --git a/experiments/mixed-execution-plan/Cargo.lock b/experiments/mixed-execution-plan/Cargo.lock new file mode 100644 index 000000000..68c59a5f5 --- /dev/null +++ b/experiments/mixed-execution-plan/Cargo.lock @@ -0,0 +1,1696 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anyhow" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb931c189b85683d69a5cfad41d4d418671e1ac413dd209f3f2fc31e3cfd902" + +[[package]] +name = "ar_archive_writer" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec" +dependencies = [ + "object", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bashkit" +version = "0.21.1" +dependencies = [ + "anyhow", + "async-trait", + "base64 0.23.1", + "bigdecimal", + "bitflags", + "blake2", + "bstr", + "bytes", + "bzip2", + "chrono", + "chrono-tz", + "clap", + "encoding_rs", + "fancy-regex", + "flate2", + "foldhash", + "futures-core", + "futures-util", + "getrandom 0.4.3", + "hifijson", + "hmac", + "indexmap", + "jaq-core", + "jaq-std", + "md-5", + "num-bigint", + "num-traits", + "os_display", + "regex", + "regex-automata", + "rustls", + "self_cell", + "serde", + "serde_json", + "serde_norway", + "sha1", + "sha2", + "stacker", + "thiserror", + "tokio", + "tower", + "unit-prefix", + "url", +] + +[[package]] +name = "bigdecimal" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fa3f3d8cbf4dffcfe4991de61d012bef509a409ecbe9dd41049bfe32b4d4653" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "blake2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5d4d889834ee8ecfc0f8426ad30faf7cdcb10f741a8e6d7224d95325479f6f" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "bstr" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a680398c10c7bc0488067c4612226ea905a85f607134b69f3068d505d58c4214" +dependencies = [ + "memchr", + "regex-automata", + "serde_core", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + +[[package]] +name = "bzip2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" +dependencies = [ + "libbz2-rs-sys", +] + +[[package]] +name = "cc" +version = "1.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "chrono-tz" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3" +dependencies = [ + "chrono", + "phf", +] + +[[package]] +name = "clap" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844c5c0b65be192cb68d570cca1b21a6444431d24e39c084dc0336177015337c" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_derive" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "clap_lex" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" + +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" +dependencies = [ + "cmov", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "ctutils", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "fancy-regex" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a2e16b9a584b602f1e0e5e22c30ca0906786088c27500653e432d086def8b53" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "hashbrown" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hifijson" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a9dfcf92104a9752d8dbac1879032a51873d7cebcf7e4cb2bdd0513e069440f" + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest", +] + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jaq-core" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "723ad9253808e95daa2d10ad5b258ac4e65c07003e223e08d1d8734c2942d606" +dependencies = [ + "dyn-clone", + "once_cell", + "typed-arena", +] + +[[package]] +name = "jaq-std" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56b378d4f7587d332111a92608348db6d6b9b8f7cb5ee1d2bd162ec715d7c5bf" +dependencies = [ + "aho-corasick", + "base64 0.22.1", + "bstr", + "jaq-core", + "jiff", + "libm", + "log", + "regex-bites", + "urlencoding", +] + +[[package]] +name = "jiff" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" +dependencies = [ + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5314d1d545fce0307c770d791adf20d997e0b63b64e1ffeed8a920e290eabe4" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "md-5" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mixed-plan-loops" +version = "0.0.0" +dependencies = [ + "bashkit", + "serde_json", + "tokio", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "os_display" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad5fd71b79026fb918650dde6d125000a233764f1c2f1659a1c71118e33ea08f" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" +dependencies = [ + "ar_archive_writer", + "cc", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-bites" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6a15a2fa0bfda9361941c45550896ae87b15cc6c8c939ea350079670332e211" + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_norway" +version = "0.9.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e408f29489b5fd500fab51ff1484fc859bb655f32c671f307dcd733b72e8168c" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml-norway", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stacker" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.61.2", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-width" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" + +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + +[[package]] +name = "unsafe-libyaml-norway" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39abd59bf32521c7f2301b52d05a6a2c975b6003521cbd0c6dc1582f0a22104" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/experiments/mixed-execution-plan/Cargo.toml b/experiments/mixed-execution-plan/Cargo.toml new file mode 100644 index 000000000..d01a05cab --- /dev/null +++ b/experiments/mixed-execution-plan/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "mixed-plan-loops" +publish = false +version = "0.0.0" +edition = "2024" +[workspace] +[dependencies] +bashkit = { path = "../../crates/bashkit", features = ["jq", "experimental_plan_benchmark_control"] } +tokio = { version = "1", features = ["macros", "rt", "time"] } +serde_json = "1" +[profile.release] +opt-level = 3 +lto = false +codegen-units = 16 diff --git a/experiments/mixed-execution-plan/original-adapter.lock b/experiments/mixed-execution-plan/original-adapter.lock new file mode 100644 index 000000000..ec64b42b1 --- /dev/null +++ b/experiments/mixed-execution-plan/original-adapter.lock @@ -0,0 +1,1492 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "ar_archive_writer" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523e5e187fff36fcb8d1d19ccf0ca4ca43ec3d158316057f66dc6f72716bc5ec" +dependencies = [ + "object", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bashkit" +version = "0.21.1" +dependencies = [ + "anyhow", + "async-trait", + "base64", + "bigdecimal", + "bitflags", + "blake2", + "bzip2", + "chrono", + "chrono-tz", + "clap", + "encoding_rs", + "fancy-regex", + "flate2", + "futures-core", + "futures-util", + "getrandom 0.4.3", + "hmac", + "md-5", + "num-traits", + "os_display", + "regex", + "regex-automata", + "rustls", + "serde", + "serde_json", + "sha1", + "sha2", + "stacker", + "thiserror", + "tokio", + "tower", + "unit-prefix", + "url", +] + +[[package]] +name = "bench-bashkit" +version = "0.1.0" +dependencies = [ + "bashkit", + "bench-common", + "tokio", +] + +[[package]] +name = "bench-common" +version = "0.1.0" +dependencies = [ + "libc", +] + +[[package]] +name = "bigdecimal" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fa3f3d8cbf4dffcfe4991de61d012bef509a409ecbe9dd41049bfe32b4d4653" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "blake2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5d4d889834ee8ecfc0f8426ad30faf7cdcb10f741a8e6d7224d95325479f6f" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + +[[package]] +name = "bzip2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" +dependencies = [ + "libbz2-rs-sys", +] + +[[package]] +name = "cc" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "chrono-tz" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3" +dependencies = [ + "chrono", + "phf", +] + +[[package]] +name = "clap" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac230478587d0269d8d6998b82ae69ea51509d55df66d9e92edd1f986904cd4a" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_derive" +version = "4.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "895c9d8d2ac2dd8b8a29f3724a14e72aaaa6debcf8c38c82f97305c6a172767a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "clap_lex" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" + +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" +dependencies = [ + "cmov", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "ctutils", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "encoding_rs" +version = "0.8.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "fancy-regex" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a2e16b9a584b602f1e0e5e22c30ca0906786088c27500653e432d086def8b53" +dependencies = [ + "bit-set", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide", + "zlib-rs", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest", +] + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5314d1d545fce0307c770d791adf20d997e0b63b64e1ffeed8a920e290eabe4" + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "md-5" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "os_display" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad5fd71b79026fb918650dde6d125000a233764f1c2f1659a1c71118e33ea08f" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622" +dependencies = [ + "ar_archive_writer", + "cc", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stacker" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.61.2", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-width" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" + +[[package]] +name = "unit-prefix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/experiments/mixed-execution-plan/original-adapter.rs b/experiments/mixed-execution-plan/original-adapter.rs new file mode 100644 index 000000000..ccf8274d1 --- /dev/null +++ b/experiments/mixed-execution-plan/original-adapter.rs @@ -0,0 +1,232 @@ +//! Bashkit: one in-process `Bash` interpreter per session. The guest calls a registered host +//! builtin and receives its result through ordinary shell command substitution. + +use std::time::Duration; + +use bashkit::{ + Bash, Builtin, BuiltinContext, ExecResult, ExecutionEvent, ExecutionLimits, SessionLimits, + async_trait, +}; +use bench_common::{Info, run_owned, tick}; +use tokio::runtime::{Builder, Runtime}; + +const GUEST: &str = r#" +run() { + local start=$1 count=$2 id reply + local end=$((start + count)) + for ((id = start; id < end; id++)); do + __CALL_BODY__ + done +} +"#; + +const MAX_CALLS: usize = 2_000_000; +const MAX_WORK_UNITS: u64 = 10_000_000_000; + +#[derive(Clone, Copy)] +enum CallPath { + Event, + Direct, +} + +#[derive(Clone, Copy)] +enum Reply { + Json, + Text, + Variable, + Empty, +} + +impl Reply { + fn call_body(self) -> &'static str { + match self { + Self::Json => { + r#"reply=$(call_tool "$id" "hello from the sandbox") || return + [[ $reply =~ \"id\":([0-9]+) ]] || return 3 + ((BASH_REMATCH[1] == id)) || return 4"# + } + Self::Text => { + r#"reply=$(call_tool "$id" "hello from the sandbox") || return + [[ $reply == "$id:22" ]] || return 4"# + } + Self::Variable => { + r#"call_tool "$id" "hello from the sandbox" || return + [[ $reply == "$id:22" ]] || return 4"# + } + Self::Empty => r#"call_tool "$id" "hello from the sandbox" || return"#, + } + } + + fn host_call(self, args: &[String]) -> ExecResult { + tick(); + let [id, value] = args else { + panic!("call_tool expects an ID and a string"); + }; + let length = value.len(); + ExecResult::ok(match self { + Self::Json => format!("{{\"id\":{id},\"ok\":true,\"value\":{length}}}\n"), + Self::Text | Self::Variable => format!("{id}:{length}\n"), + Self::Empty => { + let numeric_id: i64 = id.parse().expect("numeric call ID"); + std::hint::black_box((numeric_id, length)); + String::new() + } + }) + } +} + +struct Lookup(Reply); + +#[async_trait] +impl Builtin for Lookup { + async fn execute(&self, context: BuiltinContext<'_>) -> bashkit::Result { + if matches!(self.0, Reply::Variable) { + tick(); + let [id, value] = context.args else { + panic!("call_tool expects an ID and a string"); + }; + context + .variables + .insert("reply".to_string(), format!("{id}:{}", value.len())); + return Ok(ExecResult::ok("")); + } + Ok(self.0.host_call(context.args)) + } +} + +struct Session { + bash: Option, +} + +fn exec(runtime: &Runtime, session: &mut Session, script: &str) -> ExecResult { + runtime + .block_on(session.bash.as_mut().expect("session").exec(script)) + .unwrap_or_else(|error| panic!("bashkit exec failed for {script:?}: {error}")) +} + +fn exec_host_calls( + runtime: &Runtime, + session: &mut Session, + script: String, + reply: Reply, +) -> ExecResult { + let bash = session.bash.take().expect("session"); + let mut execution = bash.start_execution(script); + let result = runtime.block_on(async { + loop { + match execution.next_event().await.expect("next execution event") { + ExecutionEvent::HostCall(request) => { + assert_eq!(request.command(), "call_tool"); + execution + .resume(request.id(), reply.host_call(request.args())) + .expect("resume host call"); + } + ExecutionEvent::Complete(result) => break result, + } + } + }); + session.bash = Some(execution.into_bash().expect("completed Bash session")); + result +} + +fn new_session(runtime: &Runtime, call_path: CallPath, reply: Reply) -> Session { + let limits = ExecutionLimits::new() + .max_work_units(MAX_WORK_UNITS) + .max_commands(MAX_CALLS) + .max_loop_iterations(MAX_CALLS) + .max_total_loop_iterations(MAX_CALLS) + .timeout(Duration::from_secs(600)); + let session_limits = SessionLimits::new() + .max_total_commands(MAX_CALLS as u64) + .max_exec_calls(20); + let builder = Bash::builder() + .limits(limits) + .session_limits(session_limits); + let builder = match call_path { + CallPath::Event => builder.host_call_builtin("call_tool"), + CallPath::Direct => builder.builtin("call_tool", Box::new(Lookup(reply))), + }; + let mut session = Session { + bash: Some(builder.build()), + }; + let result = exec(runtime, &mut session, "echo $((1 + 1))"); + assert_eq!(result.exit_code, 0, "{}", result.stderr); + assert_eq!(result.stdout, "2\n"); + session +} + +fn main() { + let (key, call_path, reply) = match std::env::args().nth(1).as_deref() { + None => ("bashkit", CallPath::Event, Reply::Json), + Some("event-json") => ("event-json", CallPath::Event, Reply::Json), + Some("event-text") => ("event-text", CallPath::Event, Reply::Text), + Some("direct-json") => ("direct-json", CallPath::Direct, Reply::Json), + Some("direct-text") => ("direct-text", CallPath::Direct, Reply::Text), + Some("direct-variable") => ("direct-variable", CallPath::Direct, Reply::Variable), + Some("direct-empty") => ("direct-empty", CallPath::Direct, Reply::Empty), + Some(variant) => panic!("unknown Bashkit benchmark variant: {variant}"), + }; + let guest = GUEST.replace("__CALL_BODY__", reply.call_body()); + let runtime = Builder::new_current_thread() + .enable_time() + .build() + .expect("build Tokio runtime"); + let info = Info { + key, + language: "Shell", + crate_name: "bashkit", + version: bashkit::VERSION, + call_kind: match call_path { + CallPath::Event => "async", + CallPath::Direct => "sync", + }, + limits_enabled: format!( + "max_work_units={MAX_WORK_UNITS}, max_commands/max_loop_iterations/\ + max_total_loop_iterations={MAX_CALLS}, timeout=600s, session max_total_commands=\ + {MAX_CALLS}, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, \ + filesystem quotas and default-deny network policy remain at defaults" + ), + notes: vec![ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised \ + benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\")." + .into(), + "The Tokio current-thread runtime is host infrastructure shared by every session and is created \ + before the measured phases." + .into(), + match call_path { + CallPath::Event => "The builtin suspends execution through ExecutionHandle and the host resumes it.", + CallPath::Direct => "The builtin calls the same Rust reply handler inline with no suspension or event bridge.", + }.into(), + match reply { + Reply::Json => "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + Reply::Text => "The guest captures the plain-text ID:length reply with $(...) and checks it with string comparison.", + Reply::Variable => "The builtin writes ID:length directly to a shell variable, which the guest checks with string comparison.", + Reply::Empty => "The builtin reads the ID and string arguments and returns no payload; the guest performs no reply validation.", + }.into(), + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. \ + Timing starts at the first measured host call and records batches of 1,000 calls." + .into(), + ], + }; + run_owned( + info, + || new_session(&runtime, call_path, reply), + |session| { + let result = exec(&runtime, session, &guest); + assert_eq!(result.exit_code, 0, "{}", result.stderr); + }, + |session, start, count| { + let script = format!("run {start} {count}"); + let result = match call_path { + CallPath::Event => exec_host_calls(&runtime, session, script, reply), + CallPath::Direct => exec(&runtime, session, &script), + }; + assert_eq!(result.exit_code, 0, "{}", result.stderr); + assert!( + result.stdout.is_empty(), + "unexpected stdout: {}", + result.stdout + ); + }, + ); +} diff --git a/experiments/mixed-execution-plan/reproduce-original.py b/experiments/mixed-execution-plan/reproduce-original.py new file mode 100644 index 000000000..673b36b55 --- /dev/null +++ b/experiments/mixed-execution-plan/reproduce-original.py @@ -0,0 +1,97 @@ +"""Build matched baseline/candidate Bash adapters and alternate full event-JSON runs.""" + +import argparse +import hashlib +import json +import os +import shutil +import statistics +import subprocess +from pathlib import Path + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--baseline", type=Path, required=True) + parser.add_argument("--candidate", type=Path, required=True) + parser.add_argument("--benchmark", type=Path, required=True) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + output = args.output.resolve() + output.mkdir(parents=True, exist_ok=False) + here = Path(__file__).resolve().parent + shutil.copytree(args.benchmark / "benches/rust-hosted/common", output / "common") + env = os.environ.copy() + env.pop("BENCH_QUICK", None) + env["CARGO_TARGET_DIR"] = str(output / "target") + binaries = {} + for name, checkout in [("baseline", args.baseline), ("candidate", args.candidate)]: + project = output / name + (project / "src").mkdir(parents=True) + shutil.copy2(here / "original-adapter.rs", project / "src/main.rs") + shutil.copy2(here / "original-adapter.lock", project / "Cargo.lock") + core = json.dumps(str(checkout.resolve() / "crates/bashkit")) + (project / "Cargo.toml").write_text( + '[package]\nname="bench-bashkit"\nversion="0.1.0"\n' + 'edition="2021"\npublish=false\n[workspace]\n[dependencies]\n' + 'bench-common={path="../common"}\n' + f'bashkit={{path={core},features=["experimental_execution_plan"]}}\n' + 'tokio={version="1",features=["rt","time"]}\n' + '[profile.release]\nopt-level=3\nlto="fat"\n' + "codegen-units=1\ndebug=false\n" + ) + with (output / f"build-{name}.log").open("w") as log: + subprocess.run( + ["cargo", "+1.100.0", "build", "--locked", "--release"], + cwd=project, + env=env, + stdout=log, + stderr=subprocess.STDOUT, + check=True, + ) + binaries[name] = output / f"bench-{name}" + shutil.copy2(output / "target/release/bench-bashkit", binaries[name]) + rows = [] + for round_number in range(4): + order = ["baseline", "candidate"] + if round_number % 2: + order.reverse() + for name in order: + run = subprocess.run( + [str(binaries[name]), "event-json"], + cwd=output, + env=env, + text=True, + capture_output=True, + timeout=180, + check=False, + ) + (output / f"{round_number}-{name}.stdout").write_text(run.stdout) + (output / f"{round_number}-{name}.stderr").write_text(run.stderr) + run.check_returncode() + data = json.loads(run.stdout) + assert data["toolCallMeasuredCalls"] >= 100_000 + assert data["memorySessions"] == 1_000 and data["startRuns"] == 2_000 + rows.append({"round": round_number, "label": name, "output": data}) + print(name, round_number, data["toolCallWallUs"], flush=True) + (output / "partial.json").write_text(json.dumps(rows, indent=2) + "\n") + summary = { + name: statistics.median( + row["output"]["toolCallWallUs"] for row in rows if row["label"] == name + ) + for name in binaries + } + result = { + "profile": {"opt_level": 3, "lto": "fat", "codegen_units": 1}, + "lock_sha256": hashlib.sha256( + (here / "original-adapter.lock").read_bytes() + ).hexdigest(), + "summary_us": summary, + "runs": rows, + } + (output / "results.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(summary, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/experiments/mixed-execution-plan/src/main.rs b/experiments/mixed-execution-plan/src/main.rs new file mode 100644 index 000000000..55379a08d --- /dev/null +++ b/experiments/mixed-execution-plan/src/main.rs @@ -0,0 +1,155 @@ +use bashkit::{ + Bash, Builtin, BuiltinContext, ExecOptions, ExecResult, ExecutionExtensions, + ExperimentalPlanBenchmarkControl as Mode, +}; +use serde_json::{Value, json}; +use std::{collections::BTreeMap, sync::Arc, time::Instant}; +fn options(mode: Mode) -> ExecOptions { + ExecOptions::new().extensions(ExecutionExtensions::new().with(mode)) +} +#[tokio::main(flavor = "current_thread")] +async fn main() { + let checkout = std::path::PathBuf::from( + std::env::var_os("CODE_MODE_BENCHMARK") + .expect("set CODE_MODE_BENCHMARK to the upstream benchmark checkout"), + ); + let fanout = std::fs::read_to_string( + checkout.join("benches/fluency/runs/claude-haiku-5-5/bash/t01_fanout/script.sh"), + ) + .unwrap(); + let fixture = + std::fs::read_to_string(checkout.join("benches/fluency/fixtures/t01_fanout.json")).unwrap(); + let (inventory, fanout_expected) = inventory_fixture(&fixture); + let cases = [ + ( + "arithmetic-function", + "f() { local i total=0; for ((i=0;i<5000;i++)); do ((total+=i)); done; printf '%s\n' \"$total\"; }; f".to_owned(), + "12497500\n".to_owned(), + ), + ( + "substitution-function", + r#"f() { local i reply; for ((i=0;i<1000;i++)); do reply=$(printf '%s' "$i"); [[ $reply =~ ^([0-9]+)$ ]] || return 3; ((BASH_REMATCH[1] == i)) || return 4; done; }; f"#.to_owned(), + String::new(), + ), + ( + "jq-function", + r#"f() { local i; for ((i=0;i<64;i++)); do jq -r --argjson scale "$i" '.n * $scale' <<< '{"n":2}'; done; }; f"#.to_owned(), + (0..64).map(|i| format!("{}\n", i * 2)).collect(), + ), + ("fanout-100", fanout, fanout_expected), + ( + "short-function", + "f() { printf done; }; f".to_owned(), + "done".to_owned(), + ), + ( + "short-arithmetic", + "x=1; ((x+=2)); printf '%s' \"$x\"".to_owned(), + "3".to_owned(), + ), + ]; + let only = std::env::args().nth(1); + let rounds = std::env::var("BENCH_ROUNDS") + .ok() + .and_then(|s| s.parse().ok()) + .unwrap_or(4); + let mut rows = Vec::new(); + for round in 0..rounds { + for (name, script, expected) in &cases { + if only.as_ref().is_some_and(|filter| name != filter) { + continue; + } + for mode in if round % 2 == 0 { + [Mode::InterpreterOnly, Mode::Auto] + } else { + [Mode::Auto, Mode::InterpreterOnly] + } { + let mode_name = match mode { + Mode::Auto => "Auto", + Mode::InterpreterOnly => "InterpreterOnly", + }; + let mut samples = Vec::new(); + for index in 0..35 { + let mut bash = Bash::builder() + .builtin( + "list_warehouses", + Box::new(InventoryCommand { + list: true, + inventory: inventory.clone(), + }), + ) + .builtin( + "get_inventory", + Box::new(InventoryCommand { + list: false, + inventory: inventory.clone(), + }), + ) + .build(); + let t = Instant::now(); + let r = bash.exec_with_options(script, options(mode)).await.unwrap(); + let elapsed = t.elapsed().as_secs_f64() * 1e6; + assert_eq!(r.exit_code, 0, "{name}: {}", r.stderr); + assert!(r.stderr.is_empty(), "{}", r.stderr); + assert_eq!(r.stdout, expected.as_str(), "{name}"); + if index >= 5 { + samples.push(elapsed); + } + } + samples.sort_by(f64::total_cmp); + let row = json!({"case":name,"round":round,"mode":mode_name,"median_us":samples[samples.len()/2],"samples_us":samples}); + eprintln!("{name} {mode_name} round {round}: {} us", row["median_us"]); + rows.push(row); + } + } + } + println!( + "{}", + json!({"profile":"release opt3 lto=false codegen16; same binary; fresh Bash, setup excluded, parsing/compilation/execution included","rows":rows}) + ); +} + +struct InventoryCommand { + list: bool, + inventory: Arc>, +} + +#[bashkit::async_trait] +impl Builtin for InventoryCommand { + async fn execute(&self, ctx: BuiltinContext<'_>) -> bashkit::Result { + let value = if self.list { + assert!(ctx.args.is_empty()); + json!(self.inventory.keys().collect::>()) + } else { + assert_eq!(ctx.args.len(), 1); + self.inventory[&ctx.args[0]].clone() + }; + Ok(ExecResult::ok(format!("{value}\n"))) + } +} + +fn inventory_fixture(fixture: &str) -> (Arc>, String) { + let fixture: Value = serde_json::from_str(fixture).unwrap(); + let mut inventory = BTreeMap::new(); + let mut totals = BTreeMap::<&str, i64>::new(); + for replica in 0..20 { + for (name, stock) in fixture["inventory"].as_object().unwrap() { + inventory.insert(format!("{name}-{replica:02}"), stock.clone()); + for item in stock.as_array().unwrap() { + *totals.entry(item["sku"].as_str().unwrap()).or_default() += + item["qty"].as_i64().unwrap(); + } + } + } + assert_eq!(inventory.len(), 100); + let mut rows = totals + .into_iter() + .filter(|(_, sum)| *sum >= 50) + .collect::>(); + rows.sort_unstable_by(|(a, left), (b, right)| right.cmp(left).then_with(|| a.cmp(b))); + let expected = rows + .into_iter() + .map(|(sku, sum)| format!("{sku} {sum}\n")) + .collect(); + (Arc::new(inventory), expected) +} diff --git a/knowledge/foundations/script-execution-plan.md b/knowledge/foundations/script-execution-plan.md index 34af1e8e6..932b04db3 100644 --- a/knowledge/foundations/script-execution-plan.md +++ b/knowledge/foundations/script-execution-plan.md @@ -111,6 +111,8 @@ and restores active loop counters when execution returns an error. Arithmetic uses the normal recursion/fuel budget and variable-write checks. Compilation has real work/live-memory costs, so tight budgets can stop execution earlier than the ordinary interpreter. +Cooperative yields can suspend longer compiled scripts; browser callers should +use the async `execute()` API for them. `executeSync()` still rejects suspension. ## Validation and performance gates diff --git a/knowledge/runtimes/browser-package.md b/knowledge/runtimes/browser-package.md index 38de5732b..85bc43dd0 100644 --- a/knowledge/runtimes/browser-package.md +++ b/knowledge/runtimes/browser-package.md @@ -291,6 +291,12 @@ solve transfer size; size-oriented LLVM code generation is the larger lever. The more aggressive `opt-level = "z"` was rejected because representative arithmetic slowed about 50%, despite a larger download saving. +The opt-in execution-plan build additionally runs Binaryen's `--flatten +--rereloop -Oz --converge` after the ordinary pass to reconstruct branches in +its additional async control-flow state machines. It retains the same APIs, +limits, builtins and transfer-size budgets; the ordinary package keeps its +existing optimization passes. + CI and publication run the same bounded GNU Bash regression sample and raw / gzip / Brotli size budgets under `crates/bashkit-wasm/bench/`, in addition to all package integration tests. Browser wall-clock results are recorded, not From 30411ff264b57c48449af79529e4ff932f05fcef Mon Sep 17 00:00:00 2001 From: Mykhailo Chalyi Date: Mon, 23 Nov 2026 23:02:46 +0000 Subject: [PATCH 4/4] perf(wasm): preserve jq throughput and record mixed-plan results --- .../__test__/size-budget.test.mjs | 72 + crates/bashkit-wasm/bench/README.md | 5 +- crates/bashkit-wasm/bench/artifact.mjs | 31 +- .../results/wasm-mixed-plan-2026-11-23.json | 1160 +++++++++++ .../results/wasm-mixed-plan-2026-11-23.md | 30 + .../bench/size-budget-execution-plan.json | 3 + crates/bashkit-wasm/scripts/build.sh | 13 - experiments/mixed-execution-plan/README.md | 111 + .../results/2026-11-23-binaries.json | 27 + .../results/2026-11-23-mixed-cpu2.json | 1851 ++++++++++++++++ .../results/2026-11-23-mixed-unpinned.json | 1855 +++++++++++++++++ .../results/2026-11-23-original-cpu2.json | 347 +++ .../results/2026-11-23-original-unpinned.json | 351 ++++ .../mixed-execution-plan/validation.md | 61 + .../foundations/script-execution-plan.md | 1 + knowledge/runtimes/browser-package.md | 12 +- 16 files changed, 5905 insertions(+), 25 deletions(-) create mode 100644 crates/bashkit-wasm/__test__/size-budget.test.mjs create mode 100644 crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.json create mode 100644 crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.md create mode 100644 crates/bashkit-wasm/bench/size-budget-execution-plan.json create mode 100644 experiments/mixed-execution-plan/README.md create mode 100644 experiments/mixed-execution-plan/results/2026-11-23-binaries.json create mode 100644 experiments/mixed-execution-plan/results/2026-11-23-mixed-cpu2.json create mode 100644 experiments/mixed-execution-plan/results/2026-11-23-mixed-unpinned.json create mode 100644 experiments/mixed-execution-plan/results/2026-11-23-original-cpu2.json create mode 100644 experiments/mixed-execution-plan/results/2026-11-23-original-unpinned.json create mode 100644 experiments/mixed-execution-plan/validation.md diff --git a/crates/bashkit-wasm/__test__/size-budget.test.mjs b/crates/bashkit-wasm/__test__/size-budget.test.mjs new file mode 100644 index 000000000..754c66694 --- /dev/null +++ b/crates/bashkit-wasm/__test__/size-budget.test.mjs @@ -0,0 +1,72 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { mkdtempSync, writeFileSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { spawnSync } from "node:child_process"; +import { fileURLToPath } from "node:url"; +import { artifactBudget, checkArtifactBudget } from "../bench/artifact.mjs"; + +function withPackage(run) { + const pkg = mkdtempSync(join(tmpdir(), "bashkit-budget-")); + try { run(pkg); } finally { rmSync(pkg, { recursive: true, force: true }); } +} + +test("size: only an explicit compiler feature selects the separate gzip cap", () => { + withPackage(pkg => { + const ordinary = artifactBudget(pkg); + assert.equal(ordinary.profile, "default"); + assert.equal(ordinary.limits.gzip, 3100000); + for (const features of [[], ["terminal"], ["bashkit/experimental_execution_plan_extra"]]) { + writeFileSync(join(pkg, "build-info.json"), JSON.stringify({ features })); + assert.deepEqual(artifactBudget(pkg), ordinary); + } + for (const feature of ["experimental_execution_plan", "bashkit/experimental_execution_plan"]) { + writeFileSync(join(pkg, "build-info.json"), JSON.stringify({ features: ["terminal", feature] })); + const compiled = artifactBudget(pkg); + assert.equal(compiled.profile, "execution-plan"); + assert.deepEqual(compiled.limits, { ...ordinary.limits, gzip: 3120000 }); + const report = { total: { raw: 7900000, gzip: 3110000, brotli: 2200000 } }; + assert.throws(() => checkArtifactBudget(report, ordinary), /gzip/); + checkArtifactBudget(report, compiled); + for (const [kind, limit] of Object.entries(compiled.limits)) { + assert.throws(() => checkArtifactBudget({ total: { ...report.total, [kind]: limit + 1 } }, compiled), new RegExp(kind)); + } + } + }); +}); + +test("size: malformed feature identity fails rather than selecting a cap", () => { + withPackage(pkg => { + for (const features of [undefined, "experimental_execution_plan", [null]]) { + writeFileSync(join(pkg, "build-info.json"), JSON.stringify({ features })); + assert.throws(() => artifactBudget(pkg), /invalid build-info features/); + } + }); +}); + +test("size: the artifact CLI enforces the selected build profile", () => { + withPackage(pkg => { + const header = Buffer.from([0, 97, 115, 109, 1, 0, 0, 0]); + // A valid custom section exceeds the raw cap while compressing easily. + const padding = Buffer.alloc(8000001); + const leb = []; + for (let size = padding.length; ; size >>>= 7) { + leb.push((size & 127) | (size > 127 ? 128 : 0)); + if (size <= 127) break; + } + const oversized = Buffer.concat([header, Buffer.from([0, ...leb]), padding]); + for (const features of [[], ["bashkit/experimental_execution_plan"]]) { + writeFileSync(join(pkg, "bashkit_wasm_bg.wasm"), header); + writeFileSync(join(pkg, "build-info.json"), JSON.stringify({ features })); + const command = [fileURLToPath(new URL("../bench/artifact.mjs", import.meta.url)), pkg, "--check"]; + const run = spawnSync(process.execPath, command, { encoding: "utf8" }); + assert.equal(run.status, 0, run.stderr); + assert.equal(JSON.parse(run.stdout).budgetProfile, features.length ? "execution-plan" : "default"); + writeFileSync(join(pkg, "bashkit_wasm_bg.wasm"), oversized); + const rejected = spawnSync(process.execPath, command, { encoding: "utf8" }); + assert.notEqual(rejected.status, 0); + assert.match(rejected.stderr, /raw: .* exceeds 8000000 byte budget/); + } + }); +}); diff --git a/crates/bashkit-wasm/bench/README.md b/crates/bashkit-wasm/bench/README.md index a15c587b1..61cca1edb 100644 --- a/crates/bashkit-wasm/bench/README.md +++ b/crates/bashkit-wasm/bench/README.md @@ -14,7 +14,10 @@ macOS, `/bin/bash` 3.2 is unsuitable) and Node 22+. - `node crates/bashkit-wasm/bench/artifact.mjs [pkg] [--check]`: raw, gzip-9, Brotli-11 bytes for the actual JS + WASM load graph, SHA-256 identities, and WASM code/data/other sections. `--check` applies `size-budget.json`, with about - 4-5% headroom above the selected shipping profile. Review new measurements + 4-5% headroom above the selected shipping profile. The opt-in execution-plan + build uses the gzip override in `size-budget-execution-plan.json`, selected + from its explicit build-info features; normal package caps stay unchanged. + Review new measurements before deliberately raising a budget. No wall-clock threshold in CI. - `node crates/bashkit-wasm/bench/runtime.mjs pkg`: arithmetic, substitution, jq, and text pipelines; one warmup and seven measured fresh-instance runs. diff --git a/crates/bashkit-wasm/bench/artifact.mjs b/crates/bashkit-wasm/bench/artifact.mjs index 31b7c36f8..efd67f3a8 100644 --- a/crates/bashkit-wasm/bench/artifact.mjs +++ b/crates/bashkit-wasm/bench/artifact.mjs @@ -25,6 +25,28 @@ export function artifact(pkg) { } return { files, total: Object.fromEntries(["raw", "gzip", "brotli"].map(k => [k, files.reduce((n, f) => n + f[k], 0)])), sections }; } + +// The optional compiler has its own transfer allowance. The default published +// package keeps its original caps; identity comes from build.sh's metadata. +export function artifactBudget(pkg) { + const base = JSON.parse(readFileSync(new URL("./size-budget.json", import.meta.url))); + const metadata = resolve(pkg, "build-info.json"); + if (!existsSync(metadata)) return { profile: "default", limits: base }; + const { features } = JSON.parse(readFileSync(metadata)); + if (!Array.isArray(features) || features.some(feature => typeof feature !== "string")) { + throw new Error("invalid build-info features"); + } + const compiler = features.includes("experimental_execution_plan") || features.includes("bashkit/experimental_execution_plan"); + return compiler + ? { profile: "execution-plan", limits: { ...base, ...JSON.parse(readFileSync(new URL("./size-budget-execution-plan.json", import.meta.url))) } } + : { profile: "default", limits: base }; +} + +export function checkArtifactBudget(report, budget) { + for (const [kind, limit] of Object.entries(budget.limits)) { + if (report.total[kind] > limit) throw new Error(`${kind}: ${report.total[kind]} exceeds ${limit} byte budget (${budget.profile})`); + } +} // Node canonicalizes the module URL, but argv can retain a symlink (e.g. /var // versus /private/var on macOS). Imports must never run the CLI accidentally. if (process.argv[1] && existsSync(process.argv[1]) && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) { @@ -32,11 +54,8 @@ if (process.argv[1] && existsSync(process.argv[1]) && realpathSync(process.argv[ if (paths.length > 1) throw new Error("expected one package directory"); const pkg = resolve(paths[0] ?? new URL("../pkg/", import.meta.url).pathname); const report = artifact(pkg); + const budget = process.argv.includes("--check") ? artifactBudget(pkg) : null; + if (budget) report.budgetProfile = budget.profile; console.log(JSON.stringify(report, null, 2)); - if (process.argv.includes("--check")) { - const budgets = JSON.parse(readFileSync(new URL("./size-budget.json", import.meta.url))); - for (const [kind, budget] of Object.entries(budgets)) { - if (report.total[kind] > budget) throw new Error(`${kind}: ${report.total[kind]} exceeds ${budget} byte budget`); - } - } + if (budget) checkArtifactBudget(report, budget); } diff --git a/crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.json b/crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.json new file mode 100644 index 000000000..699b005b3 --- /dev/null +++ b/crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.json @@ -0,0 +1,1160 @@ +{ + "rust_sources_commit": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "metadata": { + "rustc": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "wasm_bindgen": "0.2.128", + "binaryen": 125, + "profile": "wasm-release, opt-level=s, fat LTO, unwind", + "features": [ + "terminal", + "bashkit/experimental_execution_plan" + ], + "node": "v24.19.0", + "cpu": "Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz", + "affinity": [ + 2 + ], + "cpu_quota": "400000 100000", + "note": "Serial fixed-CPU probes after all task Rust builds/tests; same Rust/WASM-bindgen input; only the extra Binaryen pass differs." + }, + "selected_ordinary_Oz": { + "files": [ + { + "name": "index.js", + "sha256": "5d0a70600bc6de21948a879c26c73089ff1f8317e5c38da1bc36d3534f82c385", + "raw": 4362, + "gzip": 1678, + "brotli": 1389 + }, + { + "name": "runtime-functions.js", + "sha256": "8c26e96e972435285fc905e5dc09cad48462392e3903e4ca0596f6985c323ce0", + "raw": 4785, + "gzip": 1738, + "brotli": 1455 + }, + { + "name": "bashkit_wasm.js", + "sha256": "92a4014e10610bb6a99a272fc921efa657370e3316eb8359880c916ed19c8308", + "raw": 71478, + "gzip": 9810, + "brotli": 8423 + }, + { + "name": "bashkit_wasm_bg.wasm", + "sha256": "005362abc2bcb06e4a05e21dd90b7dac151ca49f644240af966ecb10bc566bc9", + "raw": 7811403, + "gzip": 3096794, + "brotli": 2194448 + } + ], + "total": { + "raw": 7892028, + "gzip": 3110020, + "brotli": 2205715 + }, + "sections": [ + { + "name": "section-1", + "raw": 929 + }, + { + "name": "section-2", + "raw": 4312 + }, + { + "name": "section-3", + "raw": 11038 + }, + { + "name": "section-4", + "raw": 7 + }, + { + "name": "section-5", + "raw": 3 + }, + { + "name": "section-6", + "raw": 25 + }, + { + "name": "section-7", + "raw": 2003 + }, + { + "name": "section-9", + "raw": 8303 + }, + { + "name": "section-12", + "raw": 2 + }, + { + "name": "code", + "raw": 6657511 + }, + { + "name": "data", + "raw": 1127156 + }, + { + "name": "custom:producers", + "raw": 72 + } + ], + "budgetProfile": "execution-plan" + }, + "rejected_extra_flatten_rereloop_Oz_converge": { + "files": [ + { + "name": "index.js", + "sha256": "5d0a70600bc6de21948a879c26c73089ff1f8317e5c38da1bc36d3534f82c385", + "raw": 4362, + "gzip": 1678, + "brotli": 1389 + }, + { + "name": "runtime-functions.js", + "sha256": "8c26e96e972435285fc905e5dc09cad48462392e3903e4ca0596f6985c323ce0", + "raw": 4785, + "gzip": 1738, + "brotli": 1455 + }, + { + "name": "bashkit_wasm.js", + "sha256": "92a4014e10610bb6a99a272fc921efa657370e3316eb8359880c916ed19c8308", + "raw": 71478, + "gzip": 9810, + "brotli": 8423 + }, + { + "name": "bashkit_wasm_bg.wasm", + "sha256": "d61256bdaf1421ffac0ae51b605e240f630c4fb804ac1fe95c802d7785ca38a3", + "raw": 7756292, + "gzip": 3086658, + "brotli": 2188121 + } + ], + "total": { + "raw": 7836917, + "gzip": 3099884, + "brotli": 2199388 + }, + "sections": [ + { + "name": "section-1", + "raw": 928 + }, + { + "name": "section-2", + "raw": 4312 + }, + { + "name": "section-3", + "raw": 11019 + }, + { + "name": "section-4", + "raw": 7 + }, + { + "name": "section-5", + "raw": 3 + }, + { + "name": "section-6", + "raw": 25 + }, + { + "name": "section-7", + "raw": 2003 + }, + { + "name": "section-9", + "raw": 8303 + }, + { + "name": "section-12", + "raw": 2 + }, + { + "name": "code", + "raw": 6602420 + }, + { + "name": "data", + "raw": 1127156 + }, + { + "name": "custom:producers", + "raw": 72 + } + ] + }, + "warm_jq": { + "script": "seq 1000 | jq -s 'map(. * 2) | add'", + "warmups": 25, + "samples": 50, + "rounds": 4, + "selected_median_ms": 4.093118500000003, + "probe_median_ms": 4.444972000000007, + "time_change_percent": 8.596220705557478, + "runs": [ + { + "round": 0, + "mode": "before", + "median_ms": 6.449565000000007, + "samples_ms": [ + 3.1320189999999, + 3.1341620000000603, + 3.144018999999844, + 3.1543809999998302, + 3.172984000000042, + 3.176390999999967, + 3.1828259999999773, + 3.1835530000000745, + 3.3292509999998856, + 3.346183999999994, + 3.371831000000043, + 3.395678000000089, + 3.457981000000018, + 3.5091129999999566, + 3.5185699999999542, + 3.6501630000000205, + 3.6626620000000685, + 4.0958120000000235, + 4.148112000000083, + 4.255817999999977, + 4.268811000000028, + 5.166156000000001, + 5.329808999999955, + 5.46732099999997, + 5.714069999999992, + 6.449565000000007, + 6.798033999999916, + 7.07467900000006, + 7.1156259999999065, + 7.396031999999991, + 7.546423000000004, + 7.649691999999959, + 7.851072000000045, + 8.173383999999942, + 9.268596000000002, + 11.366693000000055, + 11.748959000000013, + 11.779871999999955, + 15.608082999999965, + 15.61226899999997, + 15.894216000000029, + 15.927932999999939, + 19.568729000000076, + 19.98288100000002, + 20.284819999999968, + 20.603075999999987, + 24.278549999999996, + 24.279534000000012, + 24.44569100000001, + 24.81385899999998 + ] + }, + { + "round": 0, + "mode": "after", + "median_ms": 4.035412999999949, + "samples_ms": [ + 3.133999000000017, + 3.1481299999999237, + 3.159041000000002, + 3.1760080000000244, + 3.1909500000000435, + 3.193038999999999, + 3.2202060000000756, + 3.2422239999999647, + 3.2698279999999613, + 3.2791290000000117, + 3.286151000000018, + 3.3241329999999607, + 3.3545589999999947, + 3.3583700000000363, + 3.450866000000019, + 3.455720999999926, + 3.47329400000001, + 3.4915680000000293, + 3.520960999999943, + 3.553003999999987, + 3.555396999999971, + 3.578320000000076, + 3.743741, + 3.778519000000074, + 3.7868160000000444, + 4.035412999999949, + 4.559217999999987, + 5.122918000000027, + 5.831192000000101, + 7.019443000000024, + 7.274091999999996, + 7.415791000000013, + 8.824919000000023, + 9.201528999999994, + 9.323578000000055, + 9.377410999999995, + 9.472351000000003, + 10.12593800000002, + 10.871102000000064, + 10.9127739999999, + 11.468654000000015, + 11.641331000000037, + 11.841869000000031, + 11.981247000000053, + 12.165238000000045, + 12.823779999999942, + 14.782007000000021, + 15.669673999999986, + 19.043732999999975, + 20.00612000000001 + ] + }, + { + "round": 1, + "mode": "after", + "median_ms": 4.2307630000000245, + "samples_ms": [ + 3.1308030000000144, + 3.144091000000003, + 3.1613689999999224, + 3.166166999999973, + 3.1680900000000065, + 3.2317930000000388, + 3.2481639999999743, + 3.2617680000000746, + 3.2883239999999887, + 3.3603180000000066, + 3.3973760000000084, + 3.414574000000016, + 3.4663639999999987, + 3.6013359999999466, + 3.6211530000000494, + 3.6578550000000405, + 3.7107719999999063, + 3.7421960000000354, + 3.743390999999974, + 3.8069189999999935, + 3.8926529999999957, + 3.8997909999999365, + 3.903233, + 3.9617039999999406, + 4.174314000000095, + 4.2307630000000245, + 4.251135999999974, + 4.276719999999955, + 4.63000599999998, + 4.958108999999922, + 5.973243000000025, + 7.943084999999996, + 8.141029000000003, + 8.498811000000046, + 8.697637999999984, + 8.838622999999984, + 8.868841999999972, + 9.219147999999905, + 9.394635999999991, + 9.456091000000015, + 11.536108000000013, + 11.657125000000008, + 11.763369000000012, + 12.562813000000006, + 13.581020999999964, + 15.345593000000008, + 15.57075999999995, + 16.20352700000001, + 16.472562999999923, + 29.040161000000012 + ] + }, + { + "round": 1, + "mode": "before", + "median_ms": 3.6165470000000823, + "samples_ms": [ + 3.2432529999999815, + 3.247423000000026, + 3.2526579999999967, + 3.264733999999976, + 3.270872000000054, + 3.2771060000000034, + 3.285844999999995, + 3.2897350000000642, + 3.3226499999999533, + 3.327278999999976, + 3.335961999999995, + 3.3598610000000235, + 3.381342000000018, + 3.3978399999999738, + 3.399148000000082, + 3.427861999999891, + 3.444793000000004, + 3.45660799999996, + 3.471987000000013, + 3.485783000000083, + 3.522111999999993, + 3.5343789999999444, + 3.5581300000000056, + 3.577573999999913, + 3.5798189999999295, + 3.6165470000000823, + 3.737839000000008, + 3.796430999999984, + 4.084366999999929, + 4.214731000000029, + 4.566595000000007, + 4.762629000000061, + 5.132878000000005, + 6.927124999999933, + 7.749582000000032, + 7.783591000000001, + 7.8371290000000045, + 7.950975000000085, + 10.642760000000067, + 11.702366999999981, + 11.820356999999944, + 11.875362999999993, + 11.896491999999967, + 12.25389999999993, + 13.399437999999918, + 13.48768199999995, + 15.796467000000007, + 15.895336000000043, + 18.18723799999998, + 35.161113 + ] + }, + { + "round": 2, + "mode": "before", + "median_ms": 3.893595000000005, + "samples_ms": [ + 3.23618799999997, + 3.2432430000000068, + 3.3526390000000674, + 3.3801630000000387, + 3.3891479999999774, + 3.393285999999989, + 3.401730000000043, + 3.4164220000000114, + 3.4211270000000695, + 3.429932000000008, + 3.4433119999999917, + 3.4797760000000153, + 3.5209160000000566, + 3.5220180000000028, + 3.532263000000057, + 3.5355630000000247, + 3.587851999999998, + 3.629628000000025, + 3.6379909999999427, + 3.676827000000003, + 3.6821499999999787, + 3.699938999999972, + 3.7031769999999824, + 3.7216090000000577, + 3.879073999999946, + 3.893595000000005, + 3.9998079999999163, + 4.3070909999999, + 4.844163999999978, + 5.142246999999998, + 5.24039300000004, + 5.327719000000002, + 7.239225000000033, + 7.580410000000029, + 7.586070999999947, + 7.771347999999989, + 7.871980000000008, + 8.359390000000076, + 11.260704999999916, + 11.59282399999995, + 11.681332999999995, + 11.716324999999983, + 11.796555999999896, + 15.66594699999996, + 15.74242300000003, + 15.813988999999992, + 15.816958999999997, + 16.160155999999972, + 16.586580000000026, + 20.011623999999983 + ] + }, + { + "round": 2, + "mode": "after", + "median_ms": 4.82173899999998, + "samples_ms": [ + 3.1950429999999415, + 3.21874200000002, + 3.219137000000046, + 3.2771229999999605, + 3.3304239999999936, + 3.35273200000006, + 3.3823079999999663, + 3.3953469999999015, + 3.41069200000004, + 3.4437280000000783, + 3.5066889999999376, + 3.5095269999999346, + 3.5937009999998963, + 3.6440360000000283, + 3.677793999999949, + 3.6927950000000465, + 3.716858000000002, + 3.808858999999984, + 3.8272349999999733, + 3.828734999999938, + 4.212286000000063, + 4.299879000000033, + 4.381782000000044, + 4.465799000000061, + 4.657872999999995, + 4.82173899999998, + 5.021352999999976, + 5.304340000000025, + 7.2521299999999655, + 7.745331999999962, + 8.370003999999994, + 8.48035699999997, + 9.095351999999934, + 9.47962199999995, + 9.81245100000001, + 10.378389999999968, + 10.478792999999996, + 11.490942000000018, + 11.788595999999984, + 11.880327999999963, + 13.231311000000005, + 14.994629999999916, + 15.588256000000001, + 15.709928999999988, + 16.19775699999991, + 16.445255999999972, + 16.643032999999946, + 19.221365000000105, + 20.16313600000001, + 24.61935900000003 + ] + }, + { + "round": 3, + "mode": "after", + "median_ms": 4.65918099999999, + "samples_ms": [ + 3.169340000000034, + 3.171455999999921, + 3.1885429999999815, + 3.190164999999979, + 3.196513999999979, + 3.202348000000029, + 3.2139620000000377, + 3.2774010000000544, + 3.291515000000004, + 3.322114000000056, + 3.4279579999999896, + 3.481136000000106, + 3.491488000000004, + 3.4950399999999036, + 3.5363119999999526, + 3.5388599999999997, + 3.565364000000045, + 3.5769050000000107, + 3.5872750000000906, + 3.7212670000000116, + 4.030960999999934, + 4.113639000000035, + 4.169554999999946, + 4.252732000000037, + 4.388541999999916, + 4.65918099999999, + 4.859677000000033, + 4.878789999999981, + 6.175728000000049, + 7.563987999999995, + 8.319618999999989, + 8.944837000000007, + 9.283963999999969, + 9.366152, + 9.765432999999916, + 11.011834000000022, + 11.183046999999988, + 11.264125000000035, + 11.528865999999994, + 11.666230000000041, + 11.688666000000012, + 11.852871999999934, + 12.008602999999994, + 12.166822000000025, + 14.328539999999975, + 14.48435500000005, + 16.523325999999997, + 25.743367000000035, + 29.186794000000077, + 36.36976500000003 + ] + }, + { + "round": 3, + "mode": "before", + "median_ms": 4.292642000000001, + "samples_ms": [ + 3.2633979999999383, + 3.2957190000000764, + 3.3025179999999636, + 3.3152000000000044, + 3.315825000000018, + 3.318773999999962, + 3.3196049999999104, + 3.3229820000000245, + 3.3282100000000128, + 3.3841050000000905, + 3.4098820000000387, + 3.41079000000002, + 3.459609999999998, + 3.501810999999975, + 3.5564419999999473, + 3.5579979999999978, + 3.5937280000000555, + 3.617385000000013, + 3.6716030000000046, + 3.689700000000016, + 3.74244299999998, + 3.7426249999999754, + 3.761922000000027, + 3.8683680000000322, + 4.2256419999999935, + 4.292642000000001, + 4.855801999999926, + 5.070741999999996, + 5.525902000000087, + 5.609523999999965, + 5.657345999999961, + 7.0719819999999345, + 8.26691100000005, + 8.574527999999987, + 11.956663000000049, + 12.153361000000018, + 12.413836999999944, + 12.548540000000003, + 13.376289000000043, + 15.505713000000014, + 15.78194099999996, + 16.077297000000044, + 16.29520500000001, + 16.359111999999982, + 17.039422999999942, + 17.91285899999997, + 20.16652899999997, + 20.868556000000012, + 32.05836000000011, + 38.193037000000004 + ] + } + ] + }, + "early_runtime_probes": [ + { + "round": 0, + "mode": "before", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-before-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 92.32978600000001, + 83.4408239999999, + 91.94510000000002, + 84.3599640000001, + 66.70036600000003, + 67.98625199999992, + 65.99501599999996 + ], + "median": 83.4408239999999 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 103.64410799999996, + 39.658481000000165, + 21.498452000000043, + 20.2639079999999, + 38.25360999999998, + 31.84770400000002, + 35.54252999999994 + ], + "median": 35.54252999999994 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 18.223700000000008, + 16.43082800000002, + 27.159787999999935, + 13.082935000000134, + 12.332421000000068, + 9.417379999999866, + 24.418599000000086 + ], + "median": 16.43082800000002 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 50.13332700000001, + 23.078430000000026, + 34.75194299999998, + 19.94716100000005, + 20.104774000000134, + 31.55339600000002, + 19.378892999999835 + ], + "median": 23.078430000000026 + } + } + } + }, + { + "round": 0, + "mode": "after", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-after-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 87.84389999999996, + 82.850752, + 65.61586999999997, + 67.345371, + 65.73626300000001, + 66.38489400000003, + 105.04987400000005 + ], + "median": 67.345371 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 74.55003399999987, + 36.63888999999995, + 20.744633999999905, + 21.706087000000025, + 23.988395000000082, + 25.34143899999981, + 34.48644100000001 + ], + "median": 25.34143899999981 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 32.8222310000001, + 35.24212899999998, + 21.576170000000047, + 21.21513099999993, + 21.19994500000007, + 18.246366999999964, + 5.548601999999846 + ], + "median": 21.21513099999993 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 48.64433800000006, + 27.182231, + 33.5626020000002, + 20.741575999999895, + 19.770749000000023, + 19.458569000000125, + 19.97865899999988 + ], + "median": 20.741575999999895 + } + } + } + }, + { + "round": 1, + "mode": "after", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-after-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 87.24688500000002, + 82.40318100000002, + 67.593929, + 65.975911, + 65.15837499999998, + 64.86400200000003, + 65.30292399999996 + ], + "median": 65.975911 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 104.94301899999994, + 27.814303999999993, + 21.471592999999984, + 20.55287999999996, + 19.91244500000016, + 18.691919000000098, + 17.595527000000175 + ], + "median": 20.55287999999996 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 35.078130999999985, + 37.871573000000126, + 21.37756300000001, + 33.39617499999986, + 19.864422000000104, + 10.523356000000149, + 9.441180000000031 + ], + "median": 21.37756300000001 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 42.38088799999991, + 27.022768000000042, + 35.903094999999894, + 31.364851999999928, + 42.92623100000014, + 63.857933, + 19.04321099999993 + ], + "median": 35.903094999999894 + } + } + } + }, + { + "round": 1, + "mode": "before", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-before-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 87.46232899999995, + 86.85898199999997, + 66.75034599999992, + 64.06277899999998, + 66.84835999999996, + 64.76436100000001, + 65.47840299999996 + ], + "median": 66.75034599999992 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 94.22991000000002, + 25.376389000000017, + 20.639985000000024, + 20.235027000000173, + 41.24818099999993, + 35.37064199999986, + 24.16984699999989 + ], + "median": 25.376389000000017 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 21.569570999999996, + 22.883490000000165, + 19.215989000000036, + 13.040723000000071, + 13.993126000000075, + 10.348858000000064, + 16.388868000000002 + ], + "median": 16.388868000000002 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 54.401944000000185, + 27.473304999999982, + 32.37050799999997, + 19.721947, + 19.92806399999995, + 33.038250999999946, + 19.256421000000046 + ], + "median": 27.473304999999982 + } + } + } + }, + { + "round": 2, + "mode": "before", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-before-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 120.322428, + 85.23570999999993, + 65.41643399999998, + 64.13659000000007, + 66.40516400000001, + 64.40002400000003, + 65.60289599999999 + ], + "median": 65.60289599999999 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 90.90660000000003, + 33.869162999999844, + 20.64798800000017, + 19.775630999999976, + 39.04729199999997, + 32.28560100000004, + 28.326571000000058 + ], + "median": 32.28560100000004 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 20.349003999999923, + 18.03246000000013, + 25.498357999999826, + 13.057023000000072, + 11.307873999999856, + 12.113663999999972, + 16.790828000000147 + ], + "median": 16.790828000000147 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 47.06896900000015, + 38.60782600000016, + 32.95740799999999, + 19.875859999999875, + 19.778870000000097, + 34.02811500000007, + 19.671353999999837 + ], + "median": 32.95740799999999 + } + } + } + }, + { + "round": 2, + "mode": "after", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-after-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 85.89039600000001, + 84.344738, + 68.73391300000003, + 64.89408000000003, + 167.917827, + 67.784042, + 64.50635999999997 + ], + "median": 68.73391300000003 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 84.82318199999997, + 24.841465999999855, + 20.587536, + 20.560113999999885, + 22.276047000000062, + 20.322850000000017, + 16.872265999999854 + ], + "median": 20.587536 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 37.965958, + 17.576706999999942, + 38.17326700000012, + 22.004449000000022, + 29.97583499999996, + 13.187820999999985, + 16.070394999999962 + ], + "median": 22.004449000000022 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 59.57150199999978, + 25.542837999999847, + 33.73883000000001, + 20.83064300000001, + 20.295806000000084, + 19.809652000000142, + 19.10531900000001 + ], + "median": 20.83064300000001 + } + } + } + }, + { + "round": 3, + "mode": "after", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-after-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 91.41408900000005, + 84.34152399999999, + 75.94695200000001, + 68.89339200000006, + 67.65941200000009, + 64.934122, + 64.33000000000004 + ], + "median": 68.89339200000006 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 88.84039499999994, + 25.101646000000073, + 21.726589999999987, + 19.621275999999853, + 18.488270000000057, + 20.076155999999855, + 16.869879999999966 + ], + "median": 20.076155999999855 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 29.718147000000044, + 20.26531, + 41.2630979999999, + 21.079343000000108, + 16.59905599999979, + 27.204257000000098, + 12.353904000000057 + ], + "median": 21.079343000000108 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 51.73828000000003, + 43.54316299999982, + 34.14130799999998, + 20.271034999999983, + 19.37038500000017, + 20.38058799999999, + 18.969898000000057 + ], + "median": 20.38058799999999 + } + } + } + }, + { + "round": 3, + "mode": "before", + "output": { + "node": "v24.19.0", + "package": "/workspace/scratch/bashkit-mixed-benchmark/wasm-before-rereloop", + "results": { + "arithmetic": { + "stdout": "199990000\n", + "samples": [ + 85.904469, + 84.22523000000001, + 70.06321100000002, + 67.7928169999999, + 66.69490099999996, + 66.68165799999997, + 70.58580399999994 + ], + "median": 70.06321100000002 + }, + "substitutions": { + "stdout": "hi\n", + "samples": [ + 83.7007769999999, + 25.169733000000065, + 19.202035000000024, + 21.11202900000012, + 39.21054099999992, + 36.2944930000001, + 25.138028000000077 + ], + "median": 25.169733000000065 + }, + "jq": { + "stdout": "1001000\n", + "samples": [ + 18.553912999999966, + 17.481819000000087, + 14.43702200000007, + 19.726045999999997, + 11.225785999999971, + 13.14088700000002, + 22.120867999999973 + ], + "median": 17.481819000000087 + }, + "text": { + "stdout": "10000\n", + "samples": [ + 44.577995999999985, + 22.867287000000033, + 32.188290999999936, + 18.95960500000001, + 18.819518000000016, + 31.70211099999983, + 19.64088199999992 + ], + "median": 22.867287000000033 + } + } + } + } + ] +} diff --git a/crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.md b/crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.md new file mode 100644 index 000000000..f8eb03b0d --- /dev/null +++ b/crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.md @@ -0,0 +1,30 @@ +# Mixed-plan browser build: retain execution speed + +The compiler-enabled package uses the existing `wasm-opt -Oz` pipeline. Its +bounded gzip budget is 3,120,000 bytes; the ordinary package keeps 3,100,000. +Both retain the same 8,000,000 raw and 2,220,000 Brotli limits. The optional +profile is selected only by explicit compiler features in build metadata. +Package tests check both feature spellings, default/unknown/malformed identity, +all three caps and CLI rejection of an oversized valid WASM custom section. + +| Compiler-enabled artifact | Raw bytes | gzip-9 bytes | Brotli-11 bytes | +|---|---:|---:|---:| +| Selected ordinary `-Oz` | 7,892,028 | 3,110,020 | 2,205,715 | +| Rejected extra pass | 7,836,917 | 3,099,884 | 2,199,388 | + +Adding `--flatten --rereloop -Oz --converge` saved about 10 KB gzip and passed +functionality checks. It was rejected after execution probes: four rotated, +CPU-2-pinned warm jq comparisons measured **4.093 → 4.445 ms** (+8.6%). +Each process used 25 warmups and 50 measured fresh shells, checked exact output, +then freed results and instances. Early-call probes were noisier and showed a +larger jq penalty. Host variation prevents a precise regression estimate; this +small transfer saving does not justify risking execution throughput. + +The selected package passes **86 Node tests**, **24 GNU Bash comparisons** and +its transfer caps. Rust sources are `9cab5a45`; later changes affect packaging +policy, tests and reports. No interpreter semantics, builtin inventory, panic +policy or runtime resource limit was changed for size. + +[Raw samples, artifact hashes and toolchain identity](wasm-mixed-plan-2026-11-23.json). +These are exploratory runtime probes, not wall-clock CI thresholds or a native +benchmark/site snapshot. The normal package's transfer policy is unchanged. diff --git a/crates/bashkit-wasm/bench/size-budget-execution-plan.json b/crates/bashkit-wasm/bench/size-budget-execution-plan.json new file mode 100644 index 000000000..66ddf2930 --- /dev/null +++ b/crates/bashkit-wasm/bench/size-budget-execution-plan.json @@ -0,0 +1,3 @@ +{ + "gzip": 3120000 +} diff --git a/crates/bashkit-wasm/scripts/build.sh b/crates/bashkit-wasm/scripts/build.sh index f8dd2a6a6..ed0ef4dba 100755 --- a/crates/bashkit-wasm/scripts/build.sh +++ b/crates/bashkit-wasm/scripts/build.sh @@ -54,19 +54,6 @@ if command -v wasm-opt >/dev/null 2>&1; then --enable-nontrapping-float-to-int \ --enable-sign-ext \ "$OUT_DIR/bashkit_wasm_bg.wasm" -o "$OUT_DIR/bashkit_wasm_bg.wasm" - case ",$FEATURES," in - *,experimental_execution_plan,*|*,bashkit/experimental_execution_plan,*) - # The mixed compiler adds async control-flow state machines. Reconstruct - # their branches before converging size optimization; keep the ordinary - # package's measured code-generation policy unchanged. - echo "==> wasm-opt --flatten --rereloop -Oz --converge (execution plan)" - wasm-opt --flatten --rereloop -Oz --converge \ - --enable-bulk-memory \ - --enable-nontrapping-float-to-int \ - --enable-sign-ext \ - "$OUT_DIR/bashkit_wasm_bg.wasm" -o "$OUT_DIR/bashkit_wasm_bg.wasm" - ;; - esac else WASM_OPT_VERSION=none echo "==> wasm-opt not found; skipping size optimization" diff --git a/experiments/mixed-execution-plan/README.md b/experiments/mixed-execution-plan/README.md new file mode 100644 index 000000000..6a52f2c17 --- /dev/null +++ b/experiments/mixed-execution-plan/README.md @@ -0,0 +1,111 @@ +# Mixed execution-plan experiment + +The disabled-by-default `experimental_execution_plan` feature prepares eligible +function bodies and control flow around interpreter-only operations. Scripts use +ordinary Bash syntax. Tool calls, pipelines, command substitutions, regexes and +array access retain the ordinary executor; supported arithmetic regions and +`for ((...))` clauses can compile independently. + +The `jq` builtin already compiles filters with jaq and maintains a bounded, +execution-local LRU. Mixed plans use that same backend. Compilation remains lazy: +unreachable bad filters do not fail, and current arguments, files, environment +and function shadowing still apply. This change adds no persistent compiler cache +or new jq syntax. + +## Reproduce + +Use Rust 1.100.0 and an existing checkout of +[rivet-dev/code-mode-language-benchmark](https://github.com/rivet-dev/code-mode-language-benchmark). +The harness reads its fan-out script and fixtures from that checkout; it does not +modify them. These are exploratory comparisons and do not update `/benches`. + +Same-binary interpreter/automatic-plan comparison: + +```sh +CODE_MODE_BENCHMARK=/path/to/code-mode-language-benchmark \ + cargo run --locked --release \ + --manifest-path experiments/mixed-execution-plan/Cargo.toml > /tmp/mixed-loops.json +``` + +Both modes attach the same execution-local diagnostic extension. Each case uses +a fresh shell, excludes shell construction, and includes parsing, lowering and +execution. Four rounds alternate mode order; each round discards five warmups +and keeps 30 samples. Exact stdout, stderr and exit status are checked. +The six cases cover arithmetic inside a function, substitutions with regex/array +access, jq with changing bindings, the original fan-out script with 100 warehouses, +a short function and short arithmetic. + +To compare the original event-JSON workload against the previous compiler, +create a separate baseline checkout at `abc42a7cd4b5ef0af7f60002fda698517a9db417` +and run: + +```sh +python3 experiments/mixed-execution-plan/reproduce-original.py \ + --baseline /path/to/baseline --candidate "$PWD" \ + --benchmark /path/to/code-mode-language-benchmark \ + --output /tmp/mixed-original-new +``` + +The output directory must not exist. The helper builds both direct-Bash adapters +with the same adapter source, preserved dependency lock, Rust version and fat-LTO +profile. Both enable the experimental compiler. Four rounds alternate process +order; every run checks at least 100,000 measured calls, 1,000 memory sessions and +2,000 startup samples. The guest retains `$(call_tool ...)`, JSON text and +`BASH_REMATCH`; it does not use `ScriptedTool` or a typed return-value shortcut. + +Run timings without competing builds. Same-binary diagnostic measurements and +separate production-baseline builds answer different questions and should both +be retained. The compiler remains experimental; gains on arithmetic loops alone +do not establish an end-to-end speedup for agent workloads. + +## Measured results (2026-11-23) + +Linux x86-64, Xeon Platinum 8370C, Rust 1.100.0, four-CPU cgroup quota. +The table below pins the single-threaded process to CPU 2. Times are medians +of four round medians; negative time change means less elapsed time. Each +sample includes parsing, compilation and execution on a fresh shell. + +| Same-binary case | AST (ms) | Auto (ms) | Time change | +|---|---:|---:|---:| +| arithmetic-function | 19.3967 | 9.0729 | -53.2% | +| substitution-function | 24.7907 | 23.0915 | -6.9% | +| jq-function | 2.3604 | 2.2936 | -2.8% | +| fanout-100 | 8.0037 | 8.3125 | +3.9% | +| short-function | 0.0309 | 0.0313 | +1.2% | +| short-arithmetic | 0.0294 | 0.0298 | +1.3% | + +Arithmetic inside a function improves substantially. Tool/substitution and jq +results are smaller and noisy; jq filter compilation and JSON processing are +unchanged. Fan-out and short scripts still have overhead, so this is not a +case for enabling the compiler by default. + +The separate production-baseline comparison uses the unchanged original +event-JSON adapter with the compiler enabled in both builds: + +| Original tool workload | Previous compiler (µs/call) | Mixed compiler (µs/call) | Time change | +|---|---:|---:|---:| +| CPU 2 | 30.615 | 31.523 | +3.0% | +| Unpinned | 31.745 | 30.772 | -3.1% | + +The sign reverses between affinity settings and individual rounds vary. +There is no clear end-to-end tool-call improvement. The original JSON text, +`$(...)` and regex/array validation remain intact. + +Raw samples, per-run original outputs, build profiles, dependency-lock hashes +and binary identities are in [results/](results/). Both pinned and unpinned +runs are retained. All runs were serial, after task builds/tests had finished. +An initial unpinned broad-suite pass showed roughly 2× timing clusters in +both baseline and candidate; repeated fixed-CPU diagnostics did not reproduce +that large regression. Treat small differences as exploratory host measurements. +On Linux, prefix the reproduction commands with `taskset -c 2` for the pinned +configuration, choosing a permitted CPU on another host. + +## Validation + +The PR runs existing feature-on/off CI, including optional runtime bindings, +security/failpoints and discovered fuzz targets. Local validation includes +real-Bash differential scripts, plan storage and cancellation checks, an ASan +script-plan differential campaign, and browser package and compatibility tests. +The [validation record](validation.md) lists exact commands and results. +See the [design and limits](../../knowledge/foundations/script-execution-plan.md) +and [public activation guide](../../crates/bashkit/docs/compatibility.md#experimental-execution-plans). diff --git a/experiments/mixed-execution-plan/results/2026-11-23-binaries.json b/experiments/mixed-execution-plan/results/2026-11-23-binaries.json new file mode 100644 index 000000000..ceaad429a --- /dev/null +++ b/experiments/mixed-execution-plan/results/2026-11-23-binaries.json @@ -0,0 +1,27 @@ +{ + "revision": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "rustc": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "binaries": { + "original": { + "path": "/workspace/scratch/bashkit-mixed-benchmark/bench-candidate-final", + "sha256": "f72a35f76c1b7991c7acf1c327bd257e5e350f19f57a062feb1413e9a7bb1c5b" + }, + "loops": { + "path": "/workspace/scratch/bashkit-mixed-loops-target/release/mixed-plan-loops", + "sha256": "2bb9a937e39a96cc38064cb0c5a5e2b1a86f112ddd2072563c388ceacab53e7c" + }, + "broad": { + "path": "/workspace/scratch/bashkit-mixed-benchmark/bench-broad-final", + "sha256": "bbd55ab2c1e66a1ab890eda7f41df5553ee18bef34a2477eb84745529e8ad5a7" + }, + "parallel": { + "path": "/workspace/scratch/bashkit-plan-release-target/release/build/bashkit/81cf260a316d5735/out/parallel_execution-81cf260a316d5735", + "sha256": "dd229f1a1202b53aebc649301e1ef4baa370a87fac9cfae317592097dc0008c3" + } + }, + "baseline_commit": "abc42a7cd4b5ef0af7f60002fda698517a9db417", + "baseline_binaries": { + "broad": "6543573352c7eb30bc21b0b53a8dca84ba304ace99b30ce9c1268753c728be00", + "parallel": "2761e05a787f35523d85688308e6f11e4aeeb94053fc73ad4437b45a7d26bf97" + } +} diff --git a/experiments/mixed-execution-plan/results/2026-11-23-mixed-cpu2.json b/experiments/mixed-execution-plan/results/2026-11-23-mixed-cpu2.json new file mode 100644 index 000000000..4da246fe0 --- /dev/null +++ b/experiments/mixed-execution-plan/results/2026-11-23-mixed-cpu2.json @@ -0,0 +1,1851 @@ +{ + "profile": "release opt3 lto=false codegen16; same binary; fresh Bash, setup excluded, parsing/compilation/execution included", + "rows": [ + { + "case": "arithmetic-function", + "median_us": 19243.652, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 18513.894, + 18713.604, + 18807.924, + 18813.599000000002, + 18855.775, + 18890.724000000002, + 18918.496, + 18932.668999999998, + 19008.710000000003, + 19035.502999999997, + 19056.408, + 19059.006, + 19065.182, + 19167.819, + 19184.878, + 19243.652, + 19309.541, + 19391.968, + 19478.024999999998, + 19482.561999999998, + 19567.981000000003, + 19625.214, + 19658.14, + 19742.616, + 19872.173, + 20251.383, + 20418.010000000002, + 20874.8, + 20879.427, + 22654.864999999998 + ] + }, + { + "case": "arithmetic-function", + "median_us": 9020.395, + "mode": "Auto", + "round": 0, + "samples_us": [ + 8696.545, + 8735.389, + 8794.003999999999, + 8838.810000000001, + 8841.252, + 8861.483, + 8864.907, + 8903.474, + 8908.179, + 8911.890000000001, + 8914.699999999999, + 8942.946, + 8945.348, + 8945.534, + 9014.833999999999, + 9020.395, + 9064.365, + 9075.967, + 9102.726, + 9164.972, + 9172.188, + 9175.98, + 9351.515, + 9398.585, + 9414.733999999999, + 9449.474, + 9476.773000000001, + 9519.527, + 9868.053, + 10818.524 + ] + }, + { + "case": "substitution-function", + "median_us": 25976.622000000003, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 22118.311, + 22136.122, + 22263.510000000002, + 22359.984, + 22463.751, + 22951.241, + 23262.09, + 23615.447, + 23814.129, + 24000.821, + 24037.608, + 24166.789, + 24260.897, + 24280.365, + 25414.510000000002, + 25976.622000000003, + 26383.378, + 26542.875, + 27274.368, + 28056.495, + 29071.976, + 29852.243000000002, + 30183.364, + 30265.420000000002, + 30496.949999999997, + 32940.94, + 32965.555, + 33026.883, + 36392.476, + 75531.847 + ] + }, + { + "case": "substitution-function", + "median_us": 21649.576, + "mode": "Auto", + "round": 0, + "samples_us": [ + 20743.192, + 20785.258, + 20972.436, + 21014.662, + 21125.974, + 21146.46, + 21165.844999999998, + 21248.435999999998, + 21269.516, + 21295.129999999997, + 21325.724000000002, + 21352.718, + 21461.933999999997, + 21546.514, + 21595.208000000002, + 21649.576, + 21650.172, + 21673.983, + 21749.997, + 21886.678, + 21941.313000000002, + 21969.555, + 22129.6, + 22293.16, + 22389.682, + 22758.506, + 23033.136, + 23134.08, + 23311.689, + 23882.667 + ] + }, + { + "case": "jq-function", + "median_us": 2433.709, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 2193.581, + 2211.2619999999997, + 2243.254, + 2244.089, + 2244.424, + 2271.797, + 2277.679, + 2280.3010000000004, + 2295.2799999999997, + 2328.198, + 2329.9660000000003, + 2337.746, + 2338.536, + 2398.981, + 2431.0209999999997, + 2433.709, + 2441.296, + 2449.098, + 2481.096, + 2504.96, + 2516.74, + 2533.641, + 2536.753, + 2560.558, + 2569.553, + 2589.475, + 2645.982, + 2712.1369999999997, + 2810.325, + 5892.157999999999 + ] + }, + { + "case": "jq-function", + "median_us": 2336.5769999999998, + "mode": "Auto", + "round": 0, + "samples_us": [ + 2172.184, + 2179.87, + 2200.346, + 2223.7490000000003, + 2243.232, + 2255.582, + 2257.795, + 2269.812, + 2278.862, + 2280.415, + 2301.5499999999997, + 2323.348, + 2325.8469999999998, + 2331.3140000000003, + 2334.209, + 2336.5769999999998, + 2340.1989999999996, + 2363.299, + 2384.23, + 2409.615, + 2413.5440000000003, + 2436.259, + 2450.0609999999997, + 2452.0789999999997, + 2462.547, + 2469.152, + 2514.5469999999996, + 2527.366, + 2542.2909999999997, + 2588.183 + ] + }, + { + "case": "fanout-100", + "median_us": 7979.695000000001, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 7573.48, + 7578.526000000001, + 7602.885, + 7608.191000000001, + 7639.3279999999995, + 7648.649, + 7680.854, + 7726.09, + 7759.032, + 7781.411, + 7786.873, + 7801.17, + 7822.3640000000005, + 7839.031, + 7910.8640000000005, + 7979.695000000001, + 7990.713, + 8014.806, + 8051.018999999999, + 8078.316000000001, + 8136.693, + 8184.593000000001, + 8266.787, + 8330.003, + 8378.371000000001, + 8504.161, + 8560.497, + 8601.871000000001, + 8760.04, + 9375.304 + ] + }, + { + "case": "fanout-100", + "median_us": 8039.802000000001, + "mode": "Auto", + "round": 0, + "samples_us": [ + 7620.964, + 7689.2660000000005, + 7693.893, + 7715.568, + 7740.259, + 7743.758, + 7752.804, + 7756.239, + 7757.081, + 7782.772, + 7858.16, + 7884.441000000001, + 7942.6050000000005, + 7949.056, + 8028.048, + 8039.802000000001, + 8077.575999999999, + 8117.302999999999, + 8123.73, + 8156.192, + 8175.783, + 8263.958, + 8288.929, + 8372.588, + 8415.631, + 8559.94, + 8666.077, + 8728.003, + 26560.163, + 26797.967999999997 + ] + }, + { + "case": "short-function", + "median_us": 37.061, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 30.903, + 31.288999999999998, + 31.343, + 31.832000000000004, + 31.878999999999998, + 31.945, + 31.997, + 33.448, + 34.711, + 34.759, + 34.827, + 34.919000000000004, + 36.04, + 36.551, + 36.568, + 37.061, + 37.936, + 38.111999999999995, + 38.405, + 42.412, + 46.978, + 47.413999999999994, + 61.339000000000006, + 61.40899999999999, + 61.629000000000005, + 66.634, + 107.14699999999999, + 121.768, + 137.727, + 168.056 + ] + }, + { + "case": "short-function", + "median_us": 31.865000000000002, + "mode": "Auto", + "round": 0, + "samples_us": [ + 29.921, + 30.032, + 30.299, + 30.499000000000002, + 30.514999999999997, + 30.537999999999997, + 30.554, + 30.629, + 30.636999999999997, + 30.809, + 31.102, + 31.124000000000002, + 31.133000000000003, + 31.352, + 31.357, + 31.865000000000002, + 33.464999999999996, + 33.924, + 34.928000000000004, + 36.367, + 38.361000000000004, + 39.491, + 39.674, + 39.725, + 48.513999999999996, + 52.192, + 56.742, + 99.35000000000001, + 174.74699999999999, + 271.159 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.674, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 29.089, + 29.145999999999997, + 29.198, + 29.208, + 29.236, + 29.306, + 29.366, + 29.435, + 29.437, + 29.48, + 29.495, + 29.503, + 29.529, + 29.567, + 29.575, + 29.674, + 29.697, + 29.729, + 30.057000000000002, + 30.233999999999998, + 30.332, + 30.362, + 31.649, + 31.909999999999997, + 33.338, + 33.635, + 34.0, + 37.605000000000004, + 52.760999999999996, + 60.022000000000006 + ] + }, + { + "case": "short-arithmetic", + "median_us": 30.506, + "mode": "Auto", + "round": 0, + "samples_us": [ + 28.839, + 29.048000000000002, + 29.17, + 29.221, + 29.269000000000002, + 29.281, + 29.434, + 29.54, + 29.597, + 29.602, + 29.681, + 29.699, + 29.775, + 29.954, + 30.315, + 30.506, + 32.323, + 33.125, + 33.978, + 34.038000000000004, + 34.921, + 36.529999999999994, + 37.228, + 38.853, + 40.085, + 43.17, + 43.195, + 47.704, + 57.15, + 154.126 + ] + }, + { + "case": "arithmetic-function", + "median_us": 9125.389, + "mode": "Auto", + "round": 1, + "samples_us": [ + 8674.892, + 8701.622, + 8728.06, + 8737.226, + 8756.143, + 8800.295, + 8829.114000000001, + 8860.610999999999, + 8866.721, + 8880.802, + 8893.554999999998, + 8939.729000000001, + 9047.212000000001, + 9104.276, + 9123.95, + 9125.389, + 9223.98, + 9239.208, + 9259.475, + 9312.976, + 9314.256, + 9315.772, + 9365.702, + 9371.356000000002, + 9390.784, + 9397.521, + 9408.65, + 9446.070000000002, + 10652.265, + 13961.275 + ] + }, + { + "case": "arithmetic-function", + "median_us": 19185.846999999998, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 18551.739, + 18555.662, + 18663.207000000002, + 18692.569, + 18758.957, + 18762.069, + 18792.935, + 18880.079, + 18905.271, + 18910.279, + 18963.220999999998, + 18997.180999999997, + 19116.874, + 19136.878, + 19173.341, + 19185.846999999998, + 19189.921, + 19275.47, + 19285.291, + 19317.844, + 19332.607, + 19397.915, + 19450.453999999998, + 19543.176, + 19592.296, + 19595.418, + 20079.416999999998, + 20258.255999999998, + 20491.012, + 23466.527000000002 + ] + }, + { + "case": "substitution-function", + "median_us": 23809.064000000002, + "mode": "Auto", + "round": 1, + "samples_us": [ + 20967.663, + 21026.636000000002, + 21307.275, + 21316.643, + 21487.164, + 21727.661, + 22021.382999999998, + 22585.882, + 22764.326, + 22794.667, + 22929.553, + 23250.426, + 23253.283, + 23654.753, + 23781.124, + 23809.064000000002, + 23878.009, + 24155.416999999998, + 24208.578, + 24480.189, + 25503.154, + 25693.914, + 25885.022, + 26007.86, + 27742.872, + 27825.938000000002, + 28744.65, + 31172.377, + 33236.340000000004, + 35314.126000000004 + ] + }, + { + "case": "substitution-function", + "median_us": 29491.392000000003, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 22262.826999999997, + 22403.537, + 22980.077, + 23002.731, + 23080.929, + 23196.927, + 23466.049, + 23914.389000000003, + 23948.867, + 24547.930999999997, + 24690.819, + 24926.568, + 25009.064000000002, + 25190.815, + 25200.637000000002, + 29491.392000000003, + 30266.905, + 30376.091, + 30437.501, + 30637.017, + 30690.978, + 31290.484, + 32527.093, + 32921.104999999996, + 34478.166, + 40922.091, + 41920.462999999996, + 42511.782999999996, + 46767.75, + 107465.185 + ] + }, + { + "case": "jq-function", + "median_us": 2209.378, + "mode": "Auto", + "round": 1, + "samples_us": [ + 2106.383, + 2110.063, + 2121.598, + 2124.547, + 2129.7769999999996, + 2141.112, + 2165.068, + 2168.038, + 2172.168, + 2176.464, + 2180.859, + 2189.813, + 2198.748, + 2200.5480000000002, + 2208.007, + 2209.378, + 2226.024, + 2241.7909999999997, + 2256.663, + 2265.668, + 2297.344, + 2318.888, + 2343.5389999999998, + 2355.555, + 2362.4750000000004, + 2405.2309999999998, + 2436.793, + 2501.392, + 4166.974, + 4238.831999999999 + ] + }, + { + "case": "jq-function", + "median_us": 2226.9500000000003, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 2167.048, + 2170.7749999999996, + 2181.4260000000004, + 2182.296, + 2184.223, + 2187.313, + 2187.584, + 2193.721, + 2199.21, + 2201.708, + 2205.482, + 2213.563, + 2214.146, + 2225.3540000000003, + 2225.4739999999997, + 2226.9500000000003, + 2228.1279999999997, + 2230.19, + 2233.574, + 2236.2400000000002, + 2239.842, + 2253.428, + 2265.6220000000003, + 2282.2430000000004, + 2289.976, + 2299.083, + 2413.141, + 2516.485, + 2544.4170000000004, + 2656.297 + ] + }, + { + "case": "fanout-100", + "median_us": 8472.113, + "mode": "Auto", + "round": 1, + "samples_us": [ + 7633.775, + 7662.068, + 7677.53, + 7714.5160000000005, + 7744.556, + 7793.22, + 7903.518999999999, + 7923.445, + 7947.486, + 8122.012, + 8156.3769999999995, + 8160.719999999999, + 8224.015, + 8253.17, + 8338.516000000001, + 8472.113, + 8504.166000000001, + 8521.338, + 8523.697, + 8678.152999999998, + 8736.398, + 8745.929, + 8798.345000000001, + 8807.867, + 8926.274, + 9415.114, + 9441.232, + 9560.461, + 10407.795, + 11302.127 + ] + }, + { + "case": "fanout-100", + "median_us": 7896.965, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 7633.253000000001, + 7680.32, + 7692.318, + 7699.213, + 7718.753, + 7752.946999999999, + 7765.646, + 7785.144, + 7790.642000000001, + 7826.913, + 7828.9169999999995, + 7848.424, + 7859.991999999999, + 7866.8769999999995, + 7881.867000000001, + 7896.965, + 7931.778, + 7932.034, + 7991.170000000001, + 8086.119, + 8113.174000000001, + 8184.387, + 8248.198, + 8326.172, + 8392.747000000001, + 8686.535, + 8741.547, + 8845.036, + 9178.784000000001, + 9226.831 + ] + }, + { + "case": "short-function", + "median_us": 31.327, + "mode": "Auto", + "round": 1, + "samples_us": [ + 30.22, + 30.604, + 30.651999999999997, + 30.659, + 30.669, + 30.755, + 30.804, + 30.917, + 30.985000000000003, + 31.014, + 31.025999999999996, + 31.046, + 31.093000000000004, + 31.119, + 31.136999999999997, + 31.327, + 31.391, + 31.459, + 31.584, + 31.6, + 31.903000000000002, + 32.72, + 33.117000000000004, + 34.175, + 35.969, + 37.858000000000004, + 40.64, + 55.455999999999996, + 56.146, + 171.684 + ] + }, + { + "case": "short-function", + "median_us": 30.826, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 29.834, + 29.916999999999998, + 30.195, + 30.237, + 30.279, + 30.290999999999997, + 30.309, + 30.335, + 30.444, + 30.453000000000003, + 30.5, + 30.503, + 30.503, + 30.53, + 30.805, + 30.826, + 30.854, + 31.025999999999996, + 31.119, + 31.424000000000003, + 31.439999999999998, + 32.206, + 32.312, + 33.735, + 35.528000000000006, + 36.551, + 37.342999999999996, + 44.774, + 50.439, + 186.24200000000002 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.468999999999998, + "mode": "Auto", + "round": 1, + "samples_us": [ + 28.676000000000002, + 28.680999999999997, + 28.703, + 28.842, + 28.869, + 29.057, + 29.061, + 29.105, + 29.128, + 29.181, + 29.206, + 29.283, + 29.306, + 29.403, + 29.424000000000003, + 29.468999999999998, + 29.474, + 29.492, + 29.555, + 29.575, + 29.713, + 29.752, + 29.761, + 29.775, + 30.043, + 30.585, + 30.964, + 34.365, + 35.222, + 36.591 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.698, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 28.2, + 28.235999999999997, + 28.284, + 28.368, + 28.425, + 28.445, + 28.472, + 28.614, + 28.615, + 28.762, + 28.815, + 28.871, + 28.895, + 28.896, + 29.192, + 29.698, + 29.718, + 29.762, + 29.77, + 29.994, + 30.002, + 31.435, + 32.929, + 33.352999999999994, + 33.840999999999994, + 34.551, + 50.577, + 50.952999999999996, + 53.832, + 69.692 + ] + }, + { + "case": "arithmetic-function", + "median_us": 20023.915999999997, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 18845.311999999998, + 19026.786, + 19038.635000000002, + 19227.784, + 19276.04, + 19336.475, + 19418.889000000003, + 19457.453, + 19491.82, + 19551.679, + 19709.394, + 19717.97, + 19721.316, + 19725.315, + 20001.02, + 20023.915999999997, + 20152.246, + 20178.173, + 20316.799, + 20352.899, + 20509.906000000003, + 20628.356, + 21100.256, + 21239.239, + 22006.004999999997, + 22219.006, + 23015.98, + 23271.277, + 26075.688, + 26194.127 + ] + }, + { + "case": "arithmetic-function", + "median_us": 8996.225, + "mode": "Auto", + "round": 2, + "samples_us": [ + 8614.049, + 8649.893, + 8650.557999999999, + 8667.836, + 8747.558, + 8815.306999999999, + 8816.764, + 8824.577, + 8826.987, + 8850.182999999999, + 8862.688, + 8881.145999999999, + 8910.474, + 8911.644999999999, + 8967.738, + 8996.225, + 9044.133, + 9053.839, + 9070.131000000001, + 9169.369999999999, + 9189.652, + 9257.689, + 9272.964, + 9297.941, + 9305.817, + 9403.378, + 9583.32, + 10078.748, + 10403.208, + 10413.606 + ] + }, + { + "case": "substitution-function", + "median_us": 23604.752, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 21161.52, + 21881.036, + 21885.43, + 22060.873000000003, + 22185.311999999998, + 22243.207000000002, + 22301.453999999998, + 22388.595, + 22636.735, + 22802.051, + 22823.321, + 22897.582, + 22928.572, + 23163.587, + 23230.883, + 23604.752, + 23749.112, + 25374.543999999998, + 25501.322, + 25655.355, + 26118.530000000002, + 26128.539, + 26463.262000000002, + 29484.56, + 32204.922, + 33500.592000000004, + 36524.017, + 37236.678, + 40581.565, + 63121.21599999999 + ] + }, + { + "case": "substitution-function", + "median_us": 26303.135, + "mode": "Auto", + "round": 2, + "samples_us": [ + 21543.924, + 21833.124, + 21880.989, + 21986.886000000002, + 22101.957, + 22147.009, + 22228.012, + 22742.447, + 22816.547, + 23055.696, + 23068.551, + 23345.077999999998, + 25235.611, + 25964.401, + 26195.551, + 26303.135, + 28751.203999999998, + 28825.465, + 29038.905, + 29068.887000000002, + 29087.253, + 30228.63, + 30813.490999999998, + 32105.686, + 32313.768, + 32958.516, + 35912.252, + 36892.622, + 40905.879, + 65156.065 + ] + }, + { + "case": "jq-function", + "median_us": 2443.602, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 2186.556, + 2205.458, + 2210.5409999999997, + 2213.732, + 2236.335, + 2263.31, + 2270.808, + 2273.075, + 2274.013, + 2276.659, + 2282.6220000000003, + 2296.634, + 2396.91, + 2404.138, + 2419.2380000000003, + 2443.602, + 2451.82, + 2466.842, + 2470.304, + 2488.341, + 2491.56, + 2535.489, + 2797.1910000000003, + 2861.065, + 2874.896, + 3081.331, + 3134.141, + 3407.9599999999996, + 3593.733, + 4080.76 + ] + }, + { + "case": "jq-function", + "median_us": 2509.028, + "mode": "Auto", + "round": 2, + "samples_us": [ + 2135.071, + 2137.051, + 2140.116, + 2188.775, + 2192.464, + 2227.94, + 2229.598, + 2243.1220000000003, + 2334.172, + 2374.868, + 2395.525, + 2416.215, + 2422.5029999999997, + 2430.991, + 2498.829, + 2509.028, + 2523.515, + 2563.857, + 2578.163, + 2592.192, + 2679.658, + 2695.716, + 2733.564, + 2788.2470000000003, + 2918.019, + 3526.2850000000003, + 3878.921, + 7942.348999999999, + 11338.91, + 11560.901 + ] + }, + { + "case": "fanout-100", + "median_us": 8277.79, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 7615.002, + 7690.097, + 7715.086, + 7751.344999999999, + 7775.75, + 7827.8099999999995, + 7828.098, + 7912.361, + 7912.575, + 8054.222, + 8130.859, + 8137.879000000001, + 8140.062, + 8154.845000000001, + 8272.08, + 8277.79, + 8350.701000000001, + 8474.071, + 8548.261999999999, + 8556.130000000001, + 8645.635, + 8652.340999999999, + 8681.012, + 8755.714, + 8784.369999999999, + 8992.975, + 9088.630000000001, + 9194.773, + 9602.672, + 10508.108 + ] + }, + { + "case": "fanout-100", + "median_us": 8199.638, + "mode": "Auto", + "round": 2, + "samples_us": [ + 7658.665, + 7743.659, + 7857.329999999999, + 7897.955, + 7912.818, + 7953.588, + 7954.012, + 7973.828, + 8011.342, + 8044.566, + 8050.851, + 8055.088, + 8076.409, + 8127.882, + 8129.355, + 8199.638, + 8214.749, + 8333.463, + 8410.383, + 8486.34, + 8501.889000000001, + 8552.103000000001, + 8617.251, + 8881.5, + 9071.589, + 9104.951, + 9323.295, + 10199.125, + 10441.517000000002, + 12675.017 + ] + }, + { + "case": "short-function", + "median_us": 31.053, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 29.892, + 30.184, + 30.238, + 30.247999999999998, + 30.377000000000002, + 30.451999999999998, + 30.523, + 30.823, + 30.855999999999998, + 30.906, + 30.932000000000002, + 30.939999999999998, + 30.959, + 30.976000000000003, + 31.013, + 31.053, + 31.109, + 31.183999999999997, + 31.189000000000004, + 31.282999999999998, + 31.343999999999998, + 31.767000000000003, + 31.961000000000002, + 32.325, + 32.824000000000005, + 36.567, + 36.997, + 38.855, + 54.547, + 62.005 + ] + }, + { + "case": "short-function", + "median_us": 30.714, + "mode": "Auto", + "round": 2, + "samples_us": [ + 30.046999999999997, + 30.096, + 30.156000000000002, + 30.184, + 30.277, + 30.395, + 30.425, + 30.427, + 30.463, + 30.532, + 30.602000000000004, + 30.638, + 30.645000000000003, + 30.660999999999998, + 30.689999999999998, + 30.714, + 30.727, + 30.791999999999998, + 30.984, + 31.105, + 31.414, + 31.424999999999997, + 31.54, + 31.625999999999998, + 31.627, + 31.858, + 35.312, + 35.399, + 36.446999999999996, + 36.584 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.21, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 28.364, + 28.737, + 28.844, + 28.867, + 28.915, + 28.917, + 28.93, + 28.979000000000003, + 29.02, + 29.023, + 29.03, + 29.122, + 29.131, + 29.171, + 29.206, + 29.21, + 29.241, + 29.352, + 29.43, + 29.566000000000003, + 29.699, + 29.706999999999997, + 30.571, + 31.342, + 32.419999999999995, + 34.058, + 36.018, + 38.887, + 52.663000000000004, + 129.53699999999998 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.699, + "mode": "Auto", + "round": 2, + "samples_us": [ + 28.745, + 28.833, + 28.989, + 29.073, + 29.088, + 29.162999999999997, + 29.218999999999998, + 29.282, + 29.349, + 29.375, + 29.405, + 29.474, + 29.485, + 29.497, + 29.513, + 29.699, + 29.827, + 29.847, + 29.910999999999998, + 30.099, + 30.108999999999998, + 30.374000000000002, + 30.419, + 30.527, + 32.227999999999994, + 33.335, + 33.444, + 33.814, + 54.458, + 61.836 + ] + }, + { + "case": "arithmetic-function", + "median_us": 9148.925000000001, + "mode": "Auto", + "round": 3, + "samples_us": [ + 8569.217, + 8585.374, + 8603.413, + 8636.705, + 8676.525, + 8720.271999999999, + 8736.155, + 8795.449999999999, + 8806.963, + 8847.982, + 8906.791000000001, + 8940.236, + 8981.317000000001, + 8992.462, + 9037.366999999998, + 9148.925000000001, + 9149.483, + 9177.014000000001, + 9314.634, + 9349.27, + 9439.812, + 9466.019, + 9489.351999999999, + 9603.731000000002, + 9739.584, + 9815.72, + 9966.252999999999, + 10375.654, + 10385.193, + 10781.821 + ] + }, + { + "case": "arithmetic-function", + "median_us": 19549.683, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 18788.341, + 18887.906, + 18905.0, + 18947.347999999998, + 18979.787, + 19020.694, + 19098.487, + 19098.861, + 19153.809, + 19154.442, + 19216.824, + 19328.736999999997, + 19396.545000000002, + 19432.575, + 19481.849, + 19549.683, + 19564.596, + 19670.409, + 19924.038, + 20190.623, + 20231.209, + 20268.705, + 20273.811999999998, + 20595.619, + 20598.541, + 20616.285, + 20700.476, + 20757.278000000002, + 20834.977000000003, + 24179.557 + ] + }, + { + "case": "substitution-function", + "median_us": 22373.95, + "mode": "Auto", + "round": 3, + "samples_us": [ + 20767.801, + 20775.246, + 20814.197, + 20938.110999999997, + 21197.227, + 21451.191000000003, + 21553.347, + 21610.261, + 21686.34, + 21972.255999999998, + 22095.322, + 22105.659, + 22152.254999999997, + 22180.218, + 22271.262, + 22373.95, + 22832.937, + 22989.991, + 23125.821, + 23194.063000000002, + 24699.823999999997, + 25021.238, + 30444.71, + 33140.246, + 34395.684, + 39036.187, + 39082.972, + 39768.460999999996, + 40125.855, + 42775.007 + ] + }, + { + "case": "substitution-function", + "median_us": 22816.976, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 21397.048, + 21574.601, + 21616.179, + 21711.362, + 21845.477, + 21910.684999999998, + 22016.085000000003, + 22117.319, + 22204.804, + 22409.604, + 22429.74, + 22478.931, + 22659.645, + 22736.24, + 22816.88, + 22816.976, + 23102.09, + 23403.341, + 23403.545000000002, + 23536.445, + 23903.126, + 23968.891, + 24172.866, + 24430.431, + 24621.886, + 24643.011, + 25813.118, + 25841.866, + 26423.563000000002, + 27222.032 + ] + }, + { + "case": "jq-function", + "median_us": 2250.628, + "mode": "Auto", + "round": 3, + "samples_us": [ + 2116.3250000000003, + 2118.6130000000003, + 2131.585, + 2147.46, + 2151.31, + 2154.319, + 2154.762, + 2164.201, + 2167.355, + 2178.6710000000003, + 2179.4990000000003, + 2186.6569999999997, + 2208.351, + 2228.839, + 2229.999, + 2250.628, + 2264.0170000000003, + 2298.223, + 2309.803, + 2322.986, + 2353.538, + 2437.1420000000003, + 2468.569, + 2540.2, + 2563.117, + 2568.638, + 2589.423, + 2643.741, + 2705.121, + 2740.649 + ] + }, + { + "case": "jq-function", + "median_us": 2287.056, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 2183.623, + 2188.9320000000002, + 2189.1749999999997, + 2198.743, + 2212.677, + 2218.5490000000004, + 2220.6639999999998, + 2229.802, + 2233.461, + 2239.659, + 2247.486, + 2249.362, + 2283.167, + 2283.235, + 2286.268, + 2287.056, + 2303.645, + 2323.8669999999997, + 2342.002, + 2352.4179999999997, + 2392.973, + 2455.451, + 2465.4019999999996, + 2476.418, + 2484.062, + 2523.0080000000003, + 2524.775, + 2570.844, + 2591.8740000000003, + 2933.076 + ] + }, + { + "case": "fanout-100", + "median_us": 8425.295, + "mode": "Auto", + "round": 3, + "samples_us": [ + 7726.3009999999995, + 7769.412, + 7798.053, + 7889.89, + 7906.549000000001, + 7956.934, + 7972.119, + 7985.947, + 8011.549999999999, + 8068.05, + 8098.305, + 8134.278, + 8213.546, + 8264.114, + 8324.547999999999, + 8425.295, + 8552.455, + 8676.869, + 8737.103, + 8784.19, + 8882.806999999999, + 9264.246000000001, + 9278.405, + 9292.053, + 9482.891, + 9535.145999999999, + 9559.751999999999, + 12049.032, + 13466.067, + 25389.947 + ] + }, + { + "case": "fanout-100", + "median_us": 8027.726000000001, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 7649.187, + 7719.274, + 7736.531, + 7740.841, + 7786.602, + 7804.449, + 7832.120999999999, + 7853.4580000000005, + 7858.1539999999995, + 7871.955, + 7886.8730000000005, + 7905.412, + 7918.082, + 7939.5019999999995, + 7970.378000000001, + 8027.726000000001, + 8145.757, + 8203.117, + 8218.140000000001, + 8242.159000000001, + 8259.425000000001, + 8263.775, + 8325.5, + 8576.985, + 8729.817000000001, + 8743.456, + 8883.16, + 8983.059, + 10252.023000000001, + 81593.414 + ] + }, + { + "case": "short-function", + "median_us": 31.294000000000004, + "mode": "Auto", + "round": 3, + "samples_us": [ + 29.836, + 30.287, + 30.424, + 30.602999999999998, + 30.607, + 30.626999999999995, + 30.667, + 30.704000000000004, + 30.812, + 30.876, + 30.914, + 31.068, + 31.194, + 31.213, + 31.281000000000002, + 31.294000000000004, + 31.519000000000002, + 31.563000000000002, + 31.566000000000003, + 31.987, + 32.244, + 32.462999999999994, + 32.523, + 34.919999999999995, + 36.501999999999995, + 37.73, + 39.336, + 47.43, + 56.79600000000001, + 75.146 + ] + }, + { + "case": "short-function", + "median_us": 30.435, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 29.355, + 29.468999999999998, + 29.541999999999998, + 29.658, + 29.694, + 29.726999999999997, + 29.764000000000003, + 29.781000000000002, + 29.953, + 30.006, + 30.108999999999998, + 30.171999999999997, + 30.215, + 30.375999999999998, + 30.382, + 30.435, + 30.444, + 30.539, + 30.625, + 30.657, + 30.682000000000002, + 30.830999999999996, + 30.902000000000005, + 31.394, + 31.834, + 32.586000000000006, + 36.035000000000004, + 36.882999999999996, + 40.39, + 46.836999999999996 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.973, + "mode": "Auto", + "round": 3, + "samples_us": [ + 28.764, + 28.904999999999998, + 29.028000000000002, + 29.04, + 29.200000000000003, + 29.226000000000003, + 29.226000000000003, + 29.244999999999997, + 29.247999999999998, + 29.391000000000002, + 29.404, + 29.629, + 29.713, + 29.758, + 29.772, + 29.973, + 30.364, + 30.444, + 30.638, + 33.716, + 34.424, + 34.999, + 36.259, + 37.132000000000005, + 37.547, + 48.6, + 55.349999999999994, + 56.367, + 68.07100000000001, + 169.848 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.03, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 28.399, + 28.428, + 28.511, + 28.674, + 28.675, + 28.693, + 28.715, + 28.767, + 28.798000000000002, + 28.813, + 28.835, + 28.852, + 28.855999999999998, + 28.943, + 29.025000000000002, + 29.03, + 29.096, + 29.125999999999998, + 29.13, + 29.224, + 29.437, + 29.473, + 30.091, + 31.844, + 32.193000000000005, + 33.628, + 34.041000000000004, + 50.336, + 53.050000000000004, + 58.991 + ] + } + ], + "metadata": { + "candidate_commit": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "rustc": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "cpu": "Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz", + "cpu_quota": "400000 100000", + "measurement_affinity": [ + 2 + ], + "build": { + "opt_level": 3, + "lto": false, + "codegen_units": 16 + }, + "lock_sha256": "276af8394b1d2cdd6f6975a6431e2832f1ef7b93f2a4672680cbfdaa1bc7534d", + "binary_sha256": "2bb9a937e39a96cc38064cb0c5a5e2b1a86f112ddd2072563c388ceacab53e7c", + "upstream_commit": "258b364ed8c3281667149f7beed69b3d28c1e1b3", + "rounds": 4, + "warmups_per_round_per_mode": 5, + "samples_per_round_per_mode": 30, + "construction_included": false, + "parsing_compilation_execution_included": true + } +} diff --git a/experiments/mixed-execution-plan/results/2026-11-23-mixed-unpinned.json b/experiments/mixed-execution-plan/results/2026-11-23-mixed-unpinned.json new file mode 100644 index 000000000..9adab55bb --- /dev/null +++ b/experiments/mixed-execution-plan/results/2026-11-23-mixed-unpinned.json @@ -0,0 +1,1855 @@ +{ + "profile": "release opt3 lto=false codegen16; same binary; fresh Bash, setup excluded, parsing/compilation/execution included", + "rows": [ + { + "case": "arithmetic-function", + "median_us": 21481.272, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 19842.640000000003, + 19875.627, + 20195.295, + 20271.886, + 20356.665, + 20477.308, + 20544.724000000002, + 20637.037, + 20773.89, + 20806.635000000002, + 20954.103000000003, + 21068.349, + 21108.077, + 21181.24, + 21438.996, + 21481.272, + 21495.725, + 21563.005, + 21904.84, + 21925.792999999998, + 22150.289, + 22206.26, + 22657.057, + 22669.064, + 22741.797000000002, + 23045.87, + 23145.092999999997, + 23659.674, + 30196.554, + 30606.004 + ] + }, + { + "case": "arithmetic-function", + "median_us": 9457.716, + "mode": "Auto", + "round": 0, + "samples_us": [ + 8768.55, + 8776.681, + 8843.402, + 8921.828, + 9069.664999999999, + 9082.249, + 9085.803, + 9142.237, + 9160.509, + 9181.046, + 9217.232, + 9222.476999999999, + 9315.97, + 9409.634, + 9450.673999999999, + 9457.716, + 9477.759, + 9505.016, + 9609.166000000001, + 9621.56, + 9632.91, + 9645.057999999999, + 9683.469000000001, + 9690.68, + 10515.036, + 10859.363000000001, + 11045.083, + 11090.429, + 11302.616, + 11458.064 + ] + }, + { + "case": "substitution-function", + "median_us": 25176.649999999998, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 22476.4, + 22681.778, + 22840.574999999997, + 22953.186, + 23044.963000000003, + 23063.815000000002, + 23515.096999999998, + 23592.163999999997, + 23611.295000000002, + 23826.572, + 24142.103000000003, + 24257.806, + 24531.515, + 24817.615, + 24992.897, + 25176.649999999998, + 25303.52, + 25368.42, + 25827.550000000003, + 25929.784, + 25963.311999999998, + 26382.243, + 26593.612999999998, + 27304.146, + 27614.051, + 27858.091, + 28553.608, + 29000.799, + 35122.242999999995, + 36806.23 + ] + }, + { + "case": "substitution-function", + "median_us": 22170.272, + "mode": "Auto", + "round": 0, + "samples_us": [ + 20665.813000000002, + 20975.003, + 21174.094, + 21260.844, + 21311.404, + 21321.59, + 21327.068, + 21332.626, + 21410.835, + 21426.094999999998, + 21532.931, + 21697.012000000002, + 21840.236, + 21919.287, + 22158.728, + 22170.272, + 22210.359999999997, + 22243.915, + 22254.919, + 22471.445, + 22474.795, + 22975.077, + 22980.364, + 23143.943, + 23166.874, + 23574.318, + 24455.900999999998, + 26044.303, + 29410.528, + 38427.847 + ] + }, + { + "case": "jq-function", + "median_us": 2390.975, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 2212.533, + 2223.8140000000003, + 2259.5190000000002, + 2274.599, + 2282.8140000000003, + 2300.696, + 2304.179, + 2306.8390000000004, + 2315.413, + 2322.9990000000003, + 2325.1119999999996, + 2331.955, + 2354.816, + 2357.839, + 2389.44, + 2390.975, + 2397.179, + 2410.836, + 2414.943, + 2449.376, + 2450.079, + 2453.1090000000004, + 2471.344, + 2493.4269999999997, + 2498.6549999999997, + 2505.9, + 2556.081, + 2645.948, + 2844.462, + 4377.191 + ] + }, + { + "case": "jq-function", + "median_us": 2360.8230000000003, + "mode": "Auto", + "round": 0, + "samples_us": [ + 2165.3, + 2186.801, + 2202.6820000000002, + 2213.986, + 2214.5899999999997, + 2231.9190000000003, + 2248.304, + 2249.2369999999996, + 2251.066, + 2257.58, + 2284.485, + 2288.7329999999997, + 2290.571, + 2291.1279999999997, + 2321.9500000000003, + 2360.8230000000003, + 2368.915, + 2370.363, + 2377.4320000000002, + 2380.782, + 2384.6349999999998, + 2396.737, + 2397.451, + 2414.813, + 2448.5409999999997, + 2472.6639999999998, + 2581.565, + 2702.664, + 2819.588, + 3000.714 + ] + }, + { + "case": "fanout-100", + "median_us": 8021.052000000001, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 7668.382, + 7697.911, + 7735.769, + 7744.888999999999, + 7835.074, + 7835.3820000000005, + 7847.529, + 7900.646000000001, + 7906.288, + 7931.031999999999, + 7941.650999999999, + 8006.653000000001, + 8007.772, + 8012.326999999999, + 8012.398, + 8021.052000000001, + 8055.339999999999, + 8072.621, + 8138.457, + 8139.530000000001, + 8204.546, + 8232.385, + 8276.906, + 8338.31, + 8645.579, + 8685.284, + 8719.012999999999, + 8802.137, + 9229.664999999999, + 10214.948 + ] + }, + { + "case": "fanout-100", + "median_us": 8177.323, + "mode": "Auto", + "round": 0, + "samples_us": [ + 7746.353999999999, + 7750.7519999999995, + 7777.3859999999995, + 7786.93, + 7800.013, + 7914.598, + 7933.435, + 7982.4800000000005, + 7985.986000000001, + 8022.0289999999995, + 8032.900000000001, + 8068.0960000000005, + 8109.284, + 8131.344, + 8175.348000000001, + 8177.323, + 8319.996, + 8322.561, + 8361.62, + 8376.817, + 8416.705, + 8471.411, + 8649.222, + 9089.589, + 9347.632, + 9694.329, + 9999.734, + 10247.278, + 10347.557999999999, + 15123.157 + ] + }, + { + "case": "short-function", + "median_us": 31.141, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 29.969, + 30.0, + 30.19, + 30.265, + 30.387, + 30.394000000000002, + 30.398, + 30.416, + 30.537000000000003, + 30.660999999999998, + 30.744999999999997, + 30.762999999999998, + 30.773, + 30.793999999999997, + 30.855999999999998, + 31.141, + 31.153, + 31.198999999999998, + 31.201, + 31.288000000000004, + 31.371000000000002, + 31.386, + 31.429, + 31.730000000000004, + 32.548, + 32.748, + 33.887, + 35.874, + 39.029999999999994, + 54.789 + ] + }, + { + "case": "short-function", + "median_us": 30.552999999999997, + "mode": "Auto", + "round": 0, + "samples_us": [ + 30.015, + 30.134999999999998, + 30.144000000000002, + 30.177, + 30.224, + 30.238, + 30.28, + 30.348000000000003, + 30.439, + 30.451999999999998, + 30.451999999999998, + 30.467000000000002, + 30.479, + 30.48, + 30.521, + 30.552999999999997, + 30.626999999999995, + 30.66, + 30.831999999999997, + 30.877000000000002, + 31.090999999999998, + 31.273999999999997, + 31.408999999999995, + 32.569, + 32.691, + 35.053, + 35.364000000000004, + 36.514, + 53.836, + 59.64 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.622, + "mode": "InterpreterOnly", + "round": 0, + "samples_us": [ + 28.824, + 28.847, + 28.91, + 28.918, + 28.951999999999998, + 29.066, + 29.073999999999998, + 29.18, + 29.194, + 29.224, + 29.246000000000002, + 29.3, + 29.313, + 29.356, + 29.613, + 29.622, + 29.628, + 29.706, + 29.776, + 30.666, + 31.080000000000002, + 31.36, + 33.510000000000005, + 33.681, + 33.788999999999994, + 35.147, + 39.528, + 46.043, + 49.283, + 168.081 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.674, + "mode": "Auto", + "round": 0, + "samples_us": [ + 28.771, + 28.819, + 28.884999999999998, + 29.038, + 29.038, + 29.076999999999998, + 29.145999999999997, + 29.218999999999998, + 29.306, + 29.307, + 29.359, + 29.435, + 29.478, + 29.492, + 29.554, + 29.674, + 29.764000000000003, + 29.868, + 29.929000000000002, + 29.958, + 30.377000000000002, + 30.819, + 32.357, + 34.306, + 35.102, + 35.781, + 51.062, + 52.539, + 54.048, + 65.048 + ] + }, + { + "case": "arithmetic-function", + "median_us": 8888.603000000001, + "mode": "Auto", + "round": 1, + "samples_us": [ + 8660.727, + 8683.024, + 8683.885, + 8686.837, + 8697.896999999999, + 8704.280999999999, + 8705.792000000001, + 8708.804, + 8718.536, + 8762.271999999999, + 8763.339, + 8823.177, + 8824.688, + 8865.031, + 8883.829, + 8888.603000000001, + 8925.676000000001, + 8927.182, + 8945.856, + 8967.951000000001, + 9060.311, + 9072.712, + 9105.206, + 9153.484999999999, + 9274.081, + 9372.393999999998, + 9457.906, + 9599.249, + 9625.472, + 9848.675 + ] + }, + { + "case": "arithmetic-function", + "median_us": 19300.589, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 18886.536999999997, + 18920.062, + 18963.451, + 19014.324, + 19014.434, + 19053.666, + 19070.563, + 19084.334000000003, + 19116.868, + 19125.281000000003, + 19149.535, + 19162.267, + 19171.56, + 19186.754, + 19237.773, + 19300.589, + 19305.75, + 19381.943, + 19394.049, + 19461.670000000002, + 19476.998, + 19496.997, + 19580.804, + 19588.0, + 19673.614999999998, + 19709.707, + 19756.859, + 20235.644, + 20948.189, + 21115.427 + ] + }, + { + "case": "substitution-function", + "median_us": 21915.889, + "mode": "Auto", + "round": 1, + "samples_us": [ + 21000.371, + 21098.641, + 21111.29, + 21188.016, + 21223.882999999998, + 21268.409, + 21354.052, + 21382.334, + 21437.911, + 21584.354, + 21679.645, + 21763.796, + 21776.641, + 21816.939000000002, + 21839.57, + 21915.889, + 21992.689, + 22028.352000000003, + 22088.716, + 22211.189, + 22331.699, + 22372.666999999998, + 22561.914, + 24011.055, + 24396.395, + 24643.997, + 26434.335, + 28358.211000000003, + 29947.692000000003, + 31667.229 + ] + }, + { + "case": "substitution-function", + "median_us": 22108.456, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 21230.302, + 21277.042, + 21389.299, + 21466.871, + 21496.876, + 21537.684, + 21672.239999999998, + 21778.461, + 21872.353, + 21891.657, + 21934.507999999998, + 21949.547, + 21969.458000000002, + 21976.996, + 22008.868000000002, + 22108.456, + 22420.119, + 22581.802000000003, + 22635.711, + 22679.451, + 22690.333, + 22726.373, + 22748.801, + 22861.507999999998, + 23033.969, + 23293.263000000003, + 24590.748, + 24716.823, + 29418.228000000003, + 38281.682 + ] + }, + { + "case": "jq-function", + "median_us": 2244.028, + "mode": "Auto", + "round": 1, + "samples_us": [ + 2106.705, + 2124.319, + 2148.312, + 2150.371, + 2153.504, + 2159.002, + 2165.893, + 2166.753, + 2172.972, + 2174.866, + 2178.3140000000003, + 2180.8399999999997, + 2188.545, + 2202.103, + 2239.07, + 2244.028, + 2255.371, + 2270.5009999999997, + 2271.272, + 2288.333, + 2312.0710000000004, + 2319.531, + 2325.578, + 2328.09, + 2337.89, + 2345.776, + 2346.3360000000002, + 2365.584, + 2387.7439999999997, + 2499.994 + ] + }, + { + "case": "jq-function", + "median_us": 2226.716, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 2177.099, + 2186.5220000000004, + 2187.92, + 2190.1400000000003, + 2193.9300000000003, + 2201.17, + 2205.358, + 2208.537, + 2208.669, + 2210.0179999999996, + 2211.127, + 2220.7400000000002, + 2221.194, + 2221.6710000000003, + 2222.6099999999997, + 2226.716, + 2231.465, + 2233.6349999999998, + 2236.929, + 2247.93, + 2253.4, + 2259.105, + 2290.8770000000004, + 2324.492, + 2372.949, + 2390.2870000000003, + 2410.4629999999997, + 2505.549, + 2574.778, + 2575.783 + ] + }, + { + "case": "fanout-100", + "median_us": 8126.365999999999, + "mode": "Auto", + "round": 1, + "samples_us": [ + 7606.143, + 7625.182000000001, + 7757.096, + 7764.513, + 7780.523, + 7839.211, + 7847.569, + 7848.934, + 7875.936, + 7961.678, + 7963.322999999999, + 7981.3009999999995, + 8061.4929999999995, + 8094.3009999999995, + 8104.848, + 8126.365999999999, + 8129.0830000000005, + 8132.894, + 8137.205999999999, + 8220.98, + 8300.585, + 8425.246000000001, + 8428.664, + 8439.794, + 8866.348, + 9537.723, + 9692.544000000002, + 10634.894, + 11945.044, + 12640.945000000002 + ] + }, + { + "case": "fanout-100", + "median_us": 8134.522999999999, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 7568.303, + 7675.139, + 7746.374000000001, + 7868.275, + 8005.613, + 8015.016, + 8030.5380000000005, + 8035.903, + 8037.163, + 8058.762000000001, + 8064.415, + 8086.304000000001, + 8102.085999999999, + 8113.143999999999, + 8123.752999999999, + 8134.522999999999, + 8184.988, + 8191.495, + 8264.746, + 8289.32, + 8354.588, + 8435.788, + 8524.274, + 8615.932999999999, + 8632.159, + 8640.514000000001, + 9103.297999999999, + 10607.287, + 10929.973, + 13464.823 + ] + }, + { + "case": "short-function", + "median_us": 33.318999999999996, + "mode": "Auto", + "round": 1, + "samples_us": [ + 31.065999999999995, + 31.177000000000003, + 31.262, + 31.334000000000003, + 31.364, + 31.421000000000003, + 31.744, + 31.84, + 31.853, + 31.923, + 32.01, + 32.335, + 32.501, + 32.803, + 33.088, + 33.318999999999996, + 33.552, + 33.759, + 34.477999999999994, + 35.536, + 38.510000000000005, + 38.642, + 39.919999999999995, + 51.945, + 57.389, + 62.483999999999995, + 63.179, + 68.777, + 100.954, + 597.167 + ] + }, + { + "case": "short-function", + "median_us": 32.620999999999995, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 30.077, + 30.096, + 30.239, + 30.270999999999997, + 30.315, + 30.543999999999997, + 30.746, + 31.15, + 31.303, + 31.548, + 31.826000000000004, + 32.335, + 32.476, + 32.491, + 32.525, + 32.620999999999995, + 33.161, + 33.547999999999995, + 34.057, + 34.638999999999996, + 35.481, + 35.806000000000004, + 37.568, + 40.098, + 44.898, + 50.723, + 52.591, + 61.209, + 61.226, + 79.294 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.904, + "mode": "Auto", + "round": 1, + "samples_us": [ + 28.752, + 28.881, + 29.289, + 29.343999999999998, + 29.376, + 29.413, + 29.503, + 29.51, + 29.53, + 29.538999999999998, + 29.551, + 29.592000000000002, + 29.604, + 29.704, + 29.752, + 29.904, + 29.976, + 29.996, + 30.148999999999997, + 30.471999999999998, + 30.497999999999998, + 30.691000000000003, + 31.331999999999997, + 31.352, + 33.803999999999995, + 34.542, + 36.755, + 37.247, + 52.295, + 68.24300000000001 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.842, + "mode": "InterpreterOnly", + "round": 1, + "samples_us": [ + 28.868, + 29.025000000000002, + 29.203000000000003, + 29.381, + 29.418, + 29.454, + 29.459, + 29.46, + 29.465999999999998, + 29.470000000000002, + 29.487000000000002, + 29.595, + 29.621, + 29.672, + 29.824, + 29.842, + 29.873, + 30.081, + 30.323, + 30.468999999999998, + 30.732000000000003, + 31.402, + 33.458999999999996, + 33.535000000000004, + 34.452, + 35.016, + 36.415000000000006, + 37.613, + 46.010000000000005, + 63.486 + ] + }, + { + "case": "arithmetic-function", + "median_us": 22117.850000000002, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 18891.787, + 18936.469, + 19056.185999999998, + 19057.357, + 19134.132, + 19151.761, + 19477.415, + 19493.887000000002, + 20084.363, + 20155.301, + 20306.363, + 20882.318, + 21706.905, + 21988.569, + 22073.663, + 22117.850000000002, + 22390.679, + 22411.409, + 22423.992000000002, + 22833.387, + 22985.239, + 23385.074, + 24042.085000000003, + 24676.739, + 25389.278000000002, + 26455.247, + 28331.326, + 29663.438000000002, + 30878.657, + 35678.87 + ] + }, + { + "case": "arithmetic-function", + "median_us": 9036.364, + "mode": "Auto", + "round": 2, + "samples_us": [ + 8579.158, + 8695.902, + 8746.511, + 8770.176, + 8806.106, + 8825.987000000001, + 8835.921, + 8858.007, + 8894.442000000001, + 8915.15, + 8943.213, + 8965.834, + 8968.892, + 8982.758, + 8989.634999999998, + 9036.364, + 9068.427, + 9078.881000000001, + 9103.974, + 9118.787, + 9144.526, + 9153.802000000001, + 9178.481, + 9218.331, + 9225.61, + 9373.876, + 10156.911, + 11461.466999999999, + 11532.988, + 11744.905 + ] + }, + { + "case": "substitution-function", + "median_us": 22205.068000000003, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 21099.759, + 21316.744, + 21504.147, + 21520.989, + 21564.598, + 21680.221999999998, + 21691.486999999997, + 21801.642, + 21855.376, + 21866.007999999998, + 21871.380999999998, + 22048.274, + 22081.528, + 22123.106, + 22139.39, + 22205.068000000003, + 22216.07, + 22419.824, + 22451.765, + 22503.281, + 22960.675, + 23411.3, + 23678.933999999997, + 23686.012, + 23707.196, + 24077.864, + 24492.808, + 25332.32, + 25673.996000000003, + 31032.394 + ] + }, + { + "case": "substitution-function", + "median_us": 21464.727, + "mode": "Auto", + "round": 2, + "samples_us": [ + 20529.637, + 20568.707, + 20772.17, + 20951.269, + 20969.481000000003, + 20982.461, + 21014.129, + 21073.535, + 21076.498, + 21090.288, + 21356.098, + 21356.229, + 21367.2, + 21432.599, + 21455.106, + 21464.727, + 21516.285, + 21669.151, + 21749.234999999997, + 22007.021, + 22048.262, + 22056.222, + 22115.546, + 22640.299, + 22946.08, + 23028.601, + 23505.869, + 23556.292, + 24034.144, + 26817.916 + ] + }, + { + "case": "jq-function", + "median_us": 2341.713, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 2218.3450000000003, + 2222.38, + 2229.461, + 2234.9750000000004, + 2235.8500000000004, + 2236.101, + 2244.894, + 2245.235, + 2245.975, + 2248.395, + 2272.785, + 2301.4030000000002, + 2310.725, + 2330.9860000000003, + 2332.962, + 2341.713, + 2349.6290000000004, + 2350.5499999999997, + 2355.288, + 2381.076, + 2387.4700000000003, + 2469.6440000000002, + 2491.035, + 2505.613, + 2508.956, + 2574.1349999999998, + 2626.0849999999996, + 2706.4010000000003, + 2725.009, + 3396.499 + ] + }, + { + "case": "jq-function", + "median_us": 2546.6, + "mode": "Auto", + "round": 2, + "samples_us": [ + 2235.953, + 2242.923, + 2275.049, + 2279.202, + 2315.731, + 2328.49, + 2336.801, + 2355.404, + 2366.654, + 2370.824, + 2378.373, + 2446.027, + 2451.932, + 2478.157, + 2531.0950000000003, + 2546.6, + 2547.9320000000002, + 2651.451, + 2660.715, + 2900.884, + 3030.793, + 3105.851, + 3146.041, + 3341.198, + 3465.556, + 3749.491, + 4115.678, + 4115.838, + 4443.519, + 4449.695 + ] + }, + { + "case": "fanout-100", + "median_us": 8922.391, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 7820.418000000001, + 7931.268999999999, + 8022.842000000001, + 8048.632, + 8069.709, + 8097.083, + 8164.585, + 8249.553, + 8309.815999999999, + 8389.828, + 8411.67, + 8523.755, + 8606.878, + 8832.112, + 8881.352, + 8922.391, + 9408.332, + 9648.244999999999, + 9726.347, + 9882.14, + 9928.167, + 9946.257, + 10217.552, + 10593.285, + 11795.131000000001, + 13664.419, + 13911.079, + 15910.246, + 25523.408, + 39588.89 + ] + }, + { + "case": "fanout-100", + "median_us": 8213.188, + "mode": "Auto", + "round": 2, + "samples_us": [ + 7585.591, + 7651.709, + 7763.062, + 7793.107, + 7825.821, + 7846.977999999999, + 7895.272, + 7943.31, + 7954.767, + 7969.338, + 7981.544, + 8031.816000000001, + 8078.419999999999, + 8122.321, + 8152.534, + 8213.188, + 8276.413, + 8301.851, + 8350.581, + 8395.996, + 8398.917000000001, + 8563.016, + 8702.544, + 8792.532000000001, + 8982.456999999999, + 9224.69, + 9499.026, + 10032.476, + 10385.261999999999, + 11102.109 + ] + }, + { + "case": "short-function", + "median_us": 30.923999999999996, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 29.988000000000003, + 30.134999999999998, + 30.139, + 30.166, + 30.211, + 30.216, + 30.308, + 30.378999999999998, + 30.534999999999997, + 30.617, + 30.635, + 30.645999999999997, + 30.817, + 30.862, + 30.902000000000005, + 30.923999999999996, + 30.941000000000003, + 31.136999999999997, + 31.163, + 31.513, + 31.767999999999997, + 32.425000000000004, + 32.784000000000006, + 33.311, + 34.956, + 35.129999999999995, + 35.571999999999996, + 36.919, + 59.277, + 62.57000000000001 + ] + }, + { + "case": "short-function", + "median_us": 32.064, + "mode": "Auto", + "round": 2, + "samples_us": [ + 29.778, + 30.026999999999997, + 30.119, + 30.21, + 30.272000000000002, + 30.286, + 30.307, + 30.639999999999997, + 30.695999999999998, + 30.806000000000004, + 30.809, + 30.811, + 31.222, + 31.559, + 31.962000000000003, + 32.064, + 32.786, + 34.113, + 35.36, + 35.664, + 36.762, + 39.947, + 40.223, + 43.027, + 49.153, + 72.55, + 73.7, + 73.937, + 79.534, + 315.60699999999997 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.798000000000002, + "mode": "InterpreterOnly", + "round": 2, + "samples_us": [ + 28.743, + 28.889, + 28.999000000000002, + 29.003999999999998, + 29.040999999999997, + 29.082, + 29.121000000000002, + 29.145, + 29.313, + 29.386999999999997, + 29.507, + 29.569000000000003, + 29.637999999999998, + 29.64, + 29.724, + 29.798000000000002, + 30.059, + 30.134, + 30.477, + 30.574, + 31.652999999999995, + 33.717000000000006, + 34.102, + 35.835, + 37.555, + 38.172, + 38.495000000000005, + 48.028, + 61.995999999999995, + 71.83500000000001 + ] + }, + { + "case": "short-arithmetic", + "median_us": 31.055, + "mode": "Auto", + "round": 2, + "samples_us": [ + 28.907, + 28.956, + 28.976, + 29.008, + 29.081000000000003, + 29.087, + 29.198999999999998, + 29.465, + 29.587999999999997, + 29.759999999999998, + 29.798000000000002, + 29.856, + 29.857, + 30.011000000000003, + 30.121, + 31.055, + 31.061, + 31.408999999999995, + 31.869999999999997, + 33.365, + 33.806999999999995, + 34.328, + 36.331999999999994, + 36.826, + 38.074999999999996, + 38.624, + 42.907000000000004, + 52.994, + 58.208000000000006, + 77.489 + ] + }, + { + "case": "arithmetic-function", + "median_us": 9681.673, + "mode": "Auto", + "round": 3, + "samples_us": [ + 8810.994, + 8816.406, + 8876.599, + 8904.769999999999, + 8984.98, + 8993.315, + 9010.044, + 9135.17, + 9155.646999999999, + 9215.463, + 9339.925000000001, + 9348.858999999999, + 9375.117, + 9438.579000000002, + 9505.954, + 9681.673, + 9830.211, + 9836.304, + 9978.169, + 10238.74, + 10350.698, + 10381.718, + 10487.467, + 10551.68, + 11152.269, + 11635.772, + 12763.922, + 12878.286, + 13198.594, + 14712.159000000001 + ] + }, + { + "case": "arithmetic-function", + "median_us": 19664.643, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 18854.863999999998, + 18977.159, + 19101.459000000003, + 19112.565000000002, + 19145.77, + 19151.662, + 19259.152000000002, + 19262.073, + 19355.397, + 19377.721, + 19384.828, + 19436.915, + 19508.253, + 19542.569, + 19634.154000000002, + 19664.643, + 19676.448999999997, + 19766.862, + 19837.947, + 19866.36, + 19869.522, + 19880.391, + 20203.311, + 20648.723, + 20768.838, + 21117.495, + 21681.22, + 21784.177, + 22149.05, + 22740.977 + ] + }, + { + "case": "substitution-function", + "median_us": 23435.59, + "mode": "Auto", + "round": 3, + "samples_us": [ + 20569.173, + 20794.619, + 20876.793, + 20879.248, + 21194.335000000003, + 21667.085, + 21884.860999999997, + 21901.27, + 22068.041, + 22432.089, + 22498.261, + 22756.962, + 22773.315, + 23129.974000000002, + 23226.019, + 23435.59, + 24006.056, + 24097.25, + 24292.393, + 25145.121, + 25938.586, + 26050.662, + 26302.935999999998, + 26622.719999999998, + 27402.52, + 28481.833000000002, + 29122.902, + 33955.896, + 34591.662000000004, + 36319.702000000005 + ] + }, + { + "case": "substitution-function", + "median_us": 23014.076, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 21195.915999999997, + 21269.566, + 21456.426, + 21880.28, + 21988.891, + 22001.954, + 22017.019, + 22214.451, + 22275.990999999998, + 22292.579, + 22417.339, + 22494.896, + 22507.204999999998, + 22565.673000000003, + 22758.194, + 23014.076, + 23072.226000000002, + 23170.015, + 23384.244, + 23602.168, + 23856.37, + 24566.342, + 24851.297000000002, + 25318.804, + 25521.289, + 26660.875, + 27185.831000000002, + 30358.579999999998, + 32533.046000000002, + 37918.884 + ] + }, + { + "case": "jq-function", + "median_us": 2462.291, + "mode": "Auto", + "round": 3, + "samples_us": [ + 2178.884, + 2224.368, + 2227.291, + 2227.5, + 2233.79, + 2245.4939999999997, + 2250.485, + 2271.5499999999997, + 2282.945, + 2287.851, + 2320.5679999999998, + 2350.1059999999998, + 2427.223, + 2449.708, + 2459.815, + 2462.291, + 2575.179, + 2649.247, + 2652.4080000000004, + 2720.683, + 3124.02, + 3323.301, + 3451.317, + 3761.736, + 3845.649, + 3962.686, + 4121.41, + 4139.768, + 4163.58, + 5605.407 + ] + }, + { + "case": "jq-function", + "median_us": 3080.256, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 2314.872, + 2352.895, + 2379.567, + 2391.748, + 2401.11, + 2468.406, + 2516.151, + 2556.731, + 2658.473, + 2691.2720000000004, + 2766.1510000000003, + 2949.986, + 3000.373, + 3007.819, + 3071.14, + 3080.256, + 3101.3199999999997, + 3103.6459999999997, + 3277.3450000000003, + 3330.397, + 3366.819, + 3505.989, + 3582.3959999999997, + 3636.3340000000003, + 3882.2309999999998, + 3886.225, + 3933.158, + 4002.8759999999997, + 4049.617, + 4246.878 + ] + }, + { + "case": "fanout-100", + "median_us": 8425.223, + "mode": "Auto", + "round": 3, + "samples_us": [ + 7628.366, + 7845.913, + 7847.619, + 7848.3279999999995, + 7936.953, + 8026.673, + 8042.981, + 8061.975, + 8133.474, + 8197.029999999999, + 8198.443, + 8223.306, + 8293.996, + 8328.126999999999, + 8378.867, + 8425.223, + 8490.565999999999, + 8510.15, + 8531.969000000001, + 8539.921, + 8674.960000000001, + 8723.405999999999, + 9222.912, + 9706.692, + 9909.27, + 10091.498000000001, + 10875.202000000001, + 10954.18, + 11526.232, + 11594.1 + ] + }, + { + "case": "fanout-100", + "median_us": 7994.525000000001, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 7568.05, + 7619.549, + 7640.525, + 7652.6140000000005, + 7678.079, + 7735.818, + 7790.6939999999995, + 7812.035, + 7843.057000000001, + 7870.814, + 7878.115, + 7879.812, + 7924.199999999999, + 7986.302000000001, + 7986.7519999999995, + 7994.525000000001, + 8048.276, + 8054.897, + 8057.258, + 8121.840999999999, + 8231.959, + 8333.211, + 8602.614, + 8717.587000000001, + 8724.156, + 9687.892, + 9719.942000000001, + 9932.447, + 10628.769999999999, + 10892.249 + ] + }, + { + "case": "short-function", + "median_us": 30.836000000000002, + "mode": "Auto", + "round": 3, + "samples_us": [ + 29.972, + 30.016, + 30.046999999999997, + 30.064, + 30.091, + 30.162, + 30.351000000000003, + 30.418, + 30.471999999999998, + 30.471999999999998, + 30.474999999999998, + 30.546999999999997, + 30.61, + 30.623999999999995, + 30.777, + 30.836000000000002, + 30.873, + 30.972, + 31.038999999999998, + 31.041000000000004, + 31.065999999999995, + 31.077, + 31.228, + 31.408, + 31.569999999999997, + 31.889, + 32.723, + 35.467999999999996, + 37.121, + 54.487 + ] + }, + { + "case": "short-function", + "median_us": 30.783, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 29.587999999999997, + 29.714000000000002, + 29.794, + 29.871, + 29.954, + 29.971, + 30.016, + 30.081, + 30.158, + 30.161, + 30.244, + 30.255000000000003, + 30.371000000000002, + 30.375, + 30.382, + 30.783, + 30.807, + 31.028999999999996, + 31.189999999999998, + 31.407, + 31.522000000000002, + 31.677000000000003, + 34.298, + 34.522, + 35.375, + 36.59, + 53.792, + 58.965, + 69.72, + 70.743 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.896, + "mode": "Auto", + "round": 3, + "samples_us": [ + 28.326, + 28.860000000000003, + 28.867, + 28.919, + 28.921999999999997, + 29.009, + 29.023, + 29.125999999999998, + 29.197, + 29.204, + 29.368000000000002, + 29.415, + 29.475, + 29.629, + 29.777, + 29.896, + 29.901, + 30.017, + 30.435, + 30.665, + 31.053, + 31.641, + 32.445, + 33.772999999999996, + 36.146, + 39.038999999999994, + 40.077999999999996, + 46.156000000000006, + 56.918, + 112.887 + ] + }, + { + "case": "short-arithmetic", + "median_us": 29.039, + "mode": "InterpreterOnly", + "round": 3, + "samples_us": [ + 28.293000000000003, + 28.498, + 28.567, + 28.577, + 28.609, + 28.68, + 28.693, + 28.752, + 28.767, + 28.773, + 28.813, + 28.838, + 28.838, + 28.954, + 29.029, + 29.039, + 29.051000000000002, + 29.084, + 29.136, + 29.220000000000002, + 29.401, + 29.451, + 29.578, + 30.023, + 30.163, + 34.017, + 34.543, + 35.366, + 56.163, + 60.306999999999995 + ] + } + ], + "metadata": { + "candidate_commit": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "rustc": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "cpu": "Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz", + "cpu_quota": "400000 100000", + "measurement_affinity": [ + 0, + 1, + 2, + 3, + 4 + ], + "build": { + "opt_level": 3, + "lto": false, + "codegen_units": 16 + }, + "lock_sha256": "276af8394b1d2cdd6f6975a6431e2832f1ef7b93f2a4672680cbfdaa1bc7534d", + "binary_sha256": "2bb9a937e39a96cc38064cb0c5a5e2b1a86f112ddd2072563c388ceacab53e7c", + "upstream_commit": "258b364ed8c3281667149f7beed69b3d28c1e1b3", + "rounds": 4, + "warmups_per_round_per_mode": 5, + "samples_per_round_per_mode": 30, + "construction_included": false, + "parsing_compilation_execution_included": true + } +} diff --git a/experiments/mixed-execution-plan/results/2026-11-23-original-cpu2.json b/experiments/mixed-execution-plan/results/2026-11-23-original-cpu2.json new file mode 100644 index 000000000..271e607b1 --- /dev/null +++ b/experiments/mixed-execution-plan/results/2026-11-23-original-cpu2.json @@ -0,0 +1,347 @@ +{ + "metadata": { + "timestamp": "2026-11-23T22:50:34.265888+00:00", + "baseline_commit": "abc42a7cd4b5ef0af7f60002fda698517a9db417", + "candidate_base": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "candidate_diff_sha256": "9b2d2c9208199461451a77252209ff76dc6b9dd9b9cd4c42cdb26dae4cece929", + "compiler": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "profile": { + "opt_level": 3, + "lto": "fat", + "codegen_units": 1 + }, + "dependency_lock_sha256": "7218713be22ba9de683bcf697ff40705a6e567c7d2a79795486a87a26af77722", + "cpu": "Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz", + "platform": "Linux-6.18.57-x86_64-with-glibc2.41", + "note": "Unchanged original event-json Bash adapter/guest/limits; old/new both experimental_execution_plan. Baseline build preserved from previous controlled run.", + "background_note": "All task builds and local validation completed. Serial benchmark processes pinned to CPU 2; no task compiler or optimizer running.", + "cpu_quota": "400000 100000", + "binary_sha256": { + "baseline": "47473d2694274c866c40321cb5291072a0e5dbac9f1ec4816da33dd527b88d41", + "candidate": "f72a35f76c1b7991c7acf1c327bd257e5e350f19f57a062feb1413e9a7bb1c5b" + }, + "measurement_affinity": [ + 2 + ], + "rust_sources_commit": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "dirty_note": "Only experiment documentation and a knowledge link were dirty; Rust sources match the recorded commit." + }, + "summary": { + "baseline": { + "toolCallWallUs": 30.61455, + "startUs": 60.9355, + "memoryBytesPerSession": 36651.0 + }, + "candidate": { + "toolCallWallUs": 31.52295, + "startUs": 59.532, + "memoryBytesPerSession": 36655.0 + } + }, + "runs": [ + { + "round": 0, + "label": "baseline", + "load": [ + 0.15087890625, + 0.4794921875, + 1.11279296875 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 61.159, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 30.0641, + "toolCallWallMeanUs": 30.9334, + "toolCallSlowestBatchUs": 45.2739, + "toolCallCpuUs": 30.9299, + "toolCallMeasuredCalls": 106000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 106, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 0, + "label": "candidate", + "load": [ + 0.21923828125, + 0.48828125, + 1.11181640625 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 59.409, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.3327, + "toolCallWallMeanUs": 32.9517, + "toolCallSlowestBatchUs": 72.2954, + "toolCallCpuUs": 32.6949, + "toolCallMeasuredCalls": 122000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 122, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 1, + "label": "candidate", + "load": [ + 0.2822265625, + 0.4970703125, + 1.11083984375 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.165, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.5223, + "toolCallWallMeanUs": 32.8436, + "toolCallSlowestBatchUs": 74.0258, + "toolCallCpuUs": 32.4126, + "toolCallMeasuredCalls": 122000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 122, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 1, + "label": "baseline", + "load": [ + 0.33984375, + 0.505859375, + 1.10986328125 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.836, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.165, + "toolCallWallMeanUs": 32.3903, + "toolCallSlowestBatchUs": 71.0144, + "toolCallCpuUs": 31.9648, + "toolCallMeasuredCalls": 127000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 127, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 2, + "label": "baseline", + "load": [ + 0.47314453125, + 0.53076171875, + 1.11474609375 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.776, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 32.5175, + "toolCallWallMeanUs": 36.7917, + "toolCallSlowestBatchUs": 166.321, + "toolCallCpuUs": 35.722, + "toolCallMeasuredCalls": 105000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 105, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 2, + "label": "candidate", + "load": [ + 0.515625, + 0.53857421875, + 1.11376953125 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 59.425, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.5236, + "toolCallWallMeanUs": 33.3965, + "toolCallSlowestBatchUs": 131.5742, + "toolCallCpuUs": 32.8568, + "toolCallMeasuredCalls": 124000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 124, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 3, + "label": "candidate", + "load": [ + 0.5546875, + 0.54638671875, + 1.11279296875 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 59.639, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.8009, + "toolCallWallMeanUs": 33.7761, + "toolCallSlowestBatchUs": 65.072, + "toolCallCpuUs": 33.215, + "toolCallMeasuredCalls": 120000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 120, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 3, + "label": "baseline", + "load": [ + 0.5908203125, + 0.55419921875, + 1.11181640625 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 61.035, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 29.6636, + "toolCallWallMeanUs": 30.6276, + "toolCallSlowestBatchUs": 75.7109, + "toolCallCpuUs": 30.2534, + "toolCallMeasuredCalls": 124000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 124, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + } + ] +} diff --git a/experiments/mixed-execution-plan/results/2026-11-23-original-unpinned.json b/experiments/mixed-execution-plan/results/2026-11-23-original-unpinned.json new file mode 100644 index 000000000..22c0a3bfd --- /dev/null +++ b/experiments/mixed-execution-plan/results/2026-11-23-original-unpinned.json @@ -0,0 +1,351 @@ +{ + "metadata": { + "timestamp": "2026-11-23T22:42:34.372292+00:00", + "baseline_commit": "abc42a7cd4b5ef0af7f60002fda698517a9db417", + "candidate_base": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "candidate_diff_sha256": "9b2d2c9208199461451a77252209ff76dc6b9dd9b9cd4c42cdb26dae4cece929", + "compiler": "rustc 1.100.0 (0ef1bc386 2026-11-09)", + "profile": { + "opt_level": 3, + "lto": "fat", + "codegen_units": 1 + }, + "dependency_lock_sha256": "7218713be22ba9de683bcf697ff40705a6e567c7d2a79795486a87a26af77722", + "cpu": "Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz", + "platform": "Linux-6.18.57-x86_64-with-glibc2.41", + "note": "Unchanged original event-json Bash adapter/guest/limits; old/new both experimental_execution_plan. Baseline build preserved from previous controlled run.", + "background_note": "All task builds and local validation completed. Serial benchmark processes; no task compiler or optimizer running.", + "cpu_quota": "400000 100000", + "binary_sha256": { + "baseline": "47473d2694274c866c40321cb5291072a0e5dbac9f1ec4816da33dd527b88d41", + "candidate": "f72a35f76c1b7991c7acf1c327bd257e5e350f19f57a062feb1413e9a7bb1c5b" + }, + "measurement_affinity": [ + 0, + 1, + 2, + 3, + 4 + ], + "rust_sources_commit": "9cab5a45e22f6cf9dc8f6322078ae6087cd935a1", + "dirty_note": "Only experiment documentation and a knowledge link were dirty; Rust sources match the recorded commit." + }, + "summary": { + "baseline": { + "toolCallWallUs": 31.74465, + "startUs": 61.2695, + "memoryBytesPerSession": 36651.0 + }, + "candidate": { + "toolCallWallUs": 30.7716, + "startUs": 60.379000000000005, + "memoryBytesPerSession": 36655.0 + } + }, + "runs": [ + { + "round": 0, + "label": "baseline", + "load": [ + 1.001953125, + 1.2490234375, + 1.634765625 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 61.025, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 32.5066, + "toolCallWallMeanUs": 34.234, + "toolCallSlowestBatchUs": 86.89, + "toolCallCpuUs": 34.187, + "toolCallMeasuredCalls": 115000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 115, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 0, + "label": "candidate", + "load": [ + 1.00146484375, + 1.24462890625, + 1.63134765625 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.667, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 30.1991, + "toolCallWallMeanUs": 31.6712, + "toolCallSlowestBatchUs": 59.6154, + "toolCallCpuUs": 31.53, + "toolCallMeasuredCalls": 118000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 118, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 1, + "label": "candidate", + "load": [ + 1.0009765625, + 1.240234375, + 1.6279296875 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 59.698, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.5343, + "toolCallWallMeanUs": 32.8183, + "toolCallSlowestBatchUs": 78.1402, + "toolCallCpuUs": 32.7298, + "toolCallMeasuredCalls": 115000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 115, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 1, + "label": "baseline", + "load": [ + 1.00048828125, + 1.23583984375, + 1.62451171875 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.996, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 30.7908, + "toolCallWallMeanUs": 32.7799, + "toolCallSlowestBatchUs": 76.4809, + "toolCallCpuUs": 32.6547, + "toolCallMeasuredCalls": 116000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 116, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 2, + "label": "baseline", + "load": [ + 1.0, + 1.2314453125, + 1.62109375 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 61.514, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 32.2477, + "toolCallWallMeanUs": 41.6707, + "toolCallSlowestBatchUs": 176.4323, + "toolCallCpuUs": 41.5861, + "toolCallMeasuredCalls": 123000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 123, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 2, + "label": "candidate", + "load": [ + 1.080078125, + 1.24462890625, + 1.62353515625 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.73, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.3441, + "toolCallWallMeanUs": 32.2574, + "toolCallSlowestBatchUs": 49.4493, + "toolCallCpuUs": 32.222, + "toolCallMeasuredCalls": 114000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 114, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 3, + "label": "candidate", + "load": [ + 1.15380859375, + 1.25732421875, + 1.6259765625 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 60.091, + "startRuns": 2000, + "memoryBytesPerSession": 36655, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 29.7265, + "toolCallWallMeanUs": 30.2946, + "toolCallSlowestBatchUs": 43.9451, + "toolCallCpuUs": 30.2099, + "toolCallMeasuredCalls": 100000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 100, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + }, + { + "round": 3, + "label": "baseline", + "load": [ + 1.14111328125, + 1.2529296875, + 1.62255859375 + ], + "output": { + "key": "event-json", + "language": "Shell", + "crate": "bashkit", + "version": "0.21.1", + "startUs": 61.733, + "startRuns": 2000, + "memoryBytesPerSession": 36651, + "memorySessions": 1000, + "memoryStoppedBy": "target", + "memoryExtraStackBytes": 0, + "toolCallWallUs": 31.2416, + "toolCallWallMeanUs": 32.189, + "toolCallSlowestBatchUs": 46.735, + "toolCallCpuUs": 32.1411, + "toolCallMeasuredCalls": 100000, + "toolCallWarmupCalls": 20000, + "toolCallBatches": 100, + "toolCallBatchSize": 1000, + "callKind": "async", + "limitsEnabled": "max_work_units=10000000000, max_commands/max_loop_iterations/max_total_loop_iterations=2000000, timeout=600s, session max_total_commands=2000000, session max_exec_calls=20; all other ExecutionLimits, MemoryLimits, filesystem quotas and default-deny network policy remain at defaults", + "notes": [ + "Session = Bash::builder() with the normal virtual root filesystem, default features, raised benchmark fuel limits, and one host builtin; then exec(\"echo $((1 + 1))\").", + "The Tokio current-thread runtime is host infrastructure shared by every session and is created before the measured phases.", + "The builtin suspends execution through ExecutionHandle and the host resumes it.", + "The guest captures the JSON reply with $(...) and validates its ID with a regex and BASH_REMATCH.", + "The loaded shell function runs once for calibration and once for all warm-up and measured calls. Timing starts at the first measured host call and records batches of 1,000 calls." + ] + } + } + ] +} diff --git a/experiments/mixed-execution-plan/validation.md b/experiments/mixed-execution-plan/validation.md new file mode 100644 index 000000000..7c59b04df --- /dev/null +++ b/experiments/mixed-execution-plan/validation.md @@ -0,0 +1,61 @@ +# Validation record + +Implementation tested: `9cab5a45e22f6cf9dc8f6322078ae6087cd935a1` +(Rust sources; subsequent experiment documentation/results are separate). +Compiler remains disabled by default. + +- `just pre-pr`: passed, including 7,503 workspace/unit/integration/doc tests, + 277 Python script tests, formatting, normal Clippy, documentation/capability/ + workflow/knowledge checks, fork consistency and cargo-vet. +- `just test`: passed the same 7,503 tests plus all 19 serialized security + failpoint tests. The main suites include 4,000 core unit tests and 2,707 + integration tests. Expected platform/doc ignores remain unchanged. +- `cargo test -p bashkit --features failpoints,jq,experimental_plan_benchmark_control + --lib --test security_failpoint_tests -- --test-threads=1`: passed all 3,549 + compiler-enabled unit tests and 19 security failpoint tests. +- `cargo clippy --all-targets --all-features -- -D warnings`: passed. +- Final local browser package: 86/86 Node tests and 24/24 GNU Bash comparison + cases. The normal 3.1 MB gzip cap is unchanged; the compiler profile has a + separate 3.12 MB cap, with unchanged raw/Brotli caps. Both cap selection and + enforcement are tested. The extra Binaryen pass was rejected after runtime + probes; [measurements](../../crates/bashkit-wasm/bench/results/wasm-mixed-plan-2026-11-23.md) + record its size/speed tradeoff. +- The earlier CI browser job [138051986432](https://github.com/everruns/bashkit/actions/runs/45277210089/job/138051986432) + also passes streaming/main-thread/worker checks and optional embedded runtimes. + That revision used the subsequently rejected extra optimization pass; final + packaging keeps the ordinary optimization pipeline. +- A local ASan differential campaign at `b77b5203` completed 256 runs with seed + `20261123`, eight structured seeds, maximum input length 512 and 30-second + wall budget. It compares native and mixed-function execution with AST + execution, including subsequent session use. The later Rust change normalizes + the cold arithmetic compiler's source argument and outlines WASM visitors; + final PR CI rebuilds and smokes all discovered fuzz targets in both modes. + +Final-source CI fuzz build/smoke jobs also passed for both +[ordinary execution](https://github.com/everruns/bashkit/actions/runs/45277210089/job/138051986934) +and [execution plans](https://github.com/everruns/bashkit/actions/runs/45277210089/job/138051986327), +covering every manifest-discovered target. + +Resource coverage includes compilation admission/work limits, command and loop +counts, live plan storage during callbacks, release after errors and cancellation, +function scopes, output/status, dynamically changed jq arguments/filter files, +unreachable filters and function shadowing. Tests also compare ordinary and +prepared loops/functions directly with GNU Bash. + +Dependency policy: full local `cargo deny check` reports the baseline +unmaintained chrono/chrono-tz advisories (RUSTSEC-2026-0543 and +RUSTSEC-2026-0555), with no safe upgrade available in the existing graph. +Bans/licenses/sources and CI's existing Audit policy pass. No root dependency, +audit-policy exception or test limit was changed. + +The 9cab5a45 PR revision finished all 104 checks: 103 successful and one +expected skip. Both native CI modes, all discovered fuzz targets, optional +runtimes, host-tool oracles, serialized failpoints and security properties pass. + +Exploratory broad validation ran all 96 cases against Bash with zero errors +and 100% output match for both compiler revisions. The parallel-execution +Criterion quick comparison also completed. These non-publishing checks do not +update the site or establish tight performance confidence bounds. Repeated +large-case diagnostics used 40 samples, five warmups and four alternating +process rounds with CPU 2 affinity after unpinned runs showed host timing +clusters. The remaining short/fallback costs remain a default-enablement gate. diff --git a/knowledge/foundations/script-execution-plan.md b/knowledge/foundations/script-execution-plan.md index 932b04db3..34fd1014d 100644 --- a/knowledge/foundations/script-execution-plan.md +++ b/knowledge/foundations/script-execution-plan.md @@ -154,4 +154,5 @@ compilation overhead, and audit native command-boundary equivalence. - [Parser](parser.md) - [Security Testing](../security/security-testing.md) - [Performance Results](../operations/performance-results.md) +- [Mixed functions and control-flow harness](../../experiments/mixed-execution-plan/README.md) - [Experiment results and remaining gates](../../experiments/script-execution-plan/README.md) diff --git a/knowledge/runtimes/browser-package.md b/knowledge/runtimes/browser-package.md index 85bc43dd0..4f99e08b2 100644 --- a/knowledge/runtimes/browser-package.md +++ b/knowledge/runtimes/browser-package.md @@ -291,11 +291,13 @@ solve transfer size; size-oriented LLVM code generation is the larger lever. The more aggressive `opt-level = "z"` was rejected because representative arithmetic slowed about 50%, despite a larger download saving. -The opt-in execution-plan build additionally runs Binaryen's `--flatten ---rereloop -Oz --converge` after the ordinary pass to reconstruct branches in -its additional async control-flow state machines. It retains the same APIs, -limits, builtins and transfer-size budgets; the ordinary package keeps its -existing optimization passes. +The opt-in execution-plan build keeps the same optimization passes and has a +separate 3.12 MB gzip cap selected from its build metadata. Normal packages keep +the existing 3.1 MB gzip cap; raw and Brotli caps are unchanged in both profiles. +A second Binaryen flatten/rereloop/convergence pass was rejected: it saved about +10 KB but jq timings regressed in fixed-CPU probes. Execution speed takes +precedence over that small transfer saving. Tests enforce explicit feature +selection and every limit in both profiles. CI and publication run the same bounded GNU Bash regression sample and raw / gzip / Brotli size budgets under `crates/bashkit-wasm/bench/`, in addition to