Skip to content

Commit a9913ef

Browse files
authored
chore: remove unused convenience functions and fix timing docs (#59)
Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent ee4453d commit a9913ef

2 files changed

Lines changed: 7 additions & 62 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ pyhl run my_script.py
135135
pyhl run my_script.py --repeat 4 # 5 hermetic invocations
136136
```
137137

138-
Each `pyhl run` process pays a ~10s cold start (kernel boot + Py_Initialize
139-
+ preloaded imports) once, then every user invocation (including the
140-
first) runs hermetic at ~100ms — the driver snapshots the post-warmup
141-
state and restores between calls, so `__main__` globals and `sys.modules`
142-
don't leak between runs.
138+
Each `pyhl run` process pays a one-time warmup (~3 s for `Py_Initialize` +
139+
preloaded imports) on first call, then snapshots the post-warmup state.
140+
Every invocation thereafter (including subsequent calls in the same process
141+
and `--repeat` iterations) restores from the snapshot and runs hermetic
142+
at ~100 ms — `__main__` globals and `sys.modules` don't leak between runs.
143143

144144
`pyhl setup` is idempotent — re-running reports the existing install and
145145
exits 0; pass `--force` to overwrite. Artifacts are found via

host/src/lib.rs

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
//! - [`Sandbox::save_snapshot`] writes the current snapshot to disk.
4747
//! - [`Sandbox::from_snapshot_file`] recreates a sandbox straight from
4848
//! the file on disk, bypassing evolve entirely. This is how
49-
//! `pyhl run` starts in ~200ms without re-doing `Py_Initialize`.
49+
//! `pyhl run` starts in ~100ms without re-doing `Py_Initialize`.
5050
//!
5151
//! # Host filesystem
5252
//!
@@ -2210,64 +2210,9 @@ impl Sandbox {
22102210
}
22112211

22122212
// ---------------------------------------------------------------------------
2213-
// Convenience: run_vm (single-shot execution)
2213+
// Convenience: run_vm_capture_output (single-shot execution with output)
22142214
// ---------------------------------------------------------------------------
22152215

2216-
/// Run a Unikraft kernel to completion (single-shot). Thin shim over
2217-
/// [`Sandbox::builder`] for callers that don't need the full fluent API.
2218-
pub fn run_vm(
2219-
kernel_path: &Path,
2220-
initrd: Option<&[u8]>,
2221-
app_args: &[String],
2222-
config: VmConfig,
2223-
) -> Result<()> {
2224-
let _ = Sandbox::evolve_inline(kernel_path, initrd, app_args, config, None, &[], None, None)?;
2225-
Ok(())
2226-
}
2227-
2228-
/// Run a Unikraft kernel with tool dispatch support.
2229-
pub fn run_vm_with_tools(
2230-
kernel_path: &Path,
2231-
initrd: Option<&[u8]>,
2232-
app_args: &[String],
2233-
config: VmConfig,
2234-
tools: ToolRegistry,
2235-
) -> Result<()> {
2236-
let _ = Sandbox::evolve_inline(
2237-
kernel_path,
2238-
initrd,
2239-
app_args,
2240-
config,
2241-
Some(tools),
2242-
&[],
2243-
None,
2244-
None,
2245-
)?;
2246-
Ok(())
2247-
}
2248-
2249-
/// Run a Unikraft kernel with preopened host directories exposed via
2250-
/// `lib/hostfs`. Sandbox escape attempts are rejected host-side.
2251-
pub fn run_vm_with_preopens(
2252-
kernel_path: &Path,
2253-
initrd: Option<&[u8]>,
2254-
app_args: &[String],
2255-
config: VmConfig,
2256-
preopens: &[Preopen],
2257-
) -> Result<()> {
2258-
let _ = Sandbox::evolve_inline(
2259-
kernel_path,
2260-
initrd,
2261-
app_args,
2262-
config,
2263-
None,
2264-
preopens,
2265-
None,
2266-
None,
2267-
)?;
2268-
Ok(())
2269-
}
2270-
22712216
/// Output captured from a VM execution.
22722217
pub struct VmOutput {
22732218
pub output: String,

0 commit comments

Comments
 (0)