diff --git a/libquickjs-sys/build.rs b/libquickjs-sys/build.rs index 9a6796f..aaa45f0 100644 --- a/libquickjs-sys/build.rs +++ b/libquickjs-sys/build.rs @@ -114,7 +114,10 @@ fn main() { .flag_if_supported("-Wno-cast-function-type") .flag_if_supported("-Wno-implicit-fallthrough") .flag_if_supported("-Wno-enum-conversion") - .opt_level(0); + // The interpreter dispatch loop is the hottest code in every host; + // -O2 matches the official QuickJS Makefile. (This sat at -O0 from a + // 2021 bring-up experiment — a ~3-5x interpreter slowdown on MIPS.) + .opt_level(2); if is_psp { build diff --git a/libquickjs-sys/src/lib.rs b/libquickjs-sys/src/lib.rs index 6e92cca..ad7edc0 100644 --- a/libquickjs-sys/src/lib.rs +++ b/libquickjs-sys/src/lib.rs @@ -357,6 +357,11 @@ extern "C" { /// immediately, never retain it. Used by the 3D host (gfx3d.rs) to read mesh /// + command buffers handed down from JS. pub fn JS_GetArrayBuffer(ctx: *mut JSContext, psize: *mut size_t, obj: JSValue) -> *mut u8; + + /// Cycle-collector trigger threshold (bytes allocated since the last run; + /// refcounting reclaims acyclic garbage regardless). Default is 256 KB. + pub fn JS_SetGCThreshold(rt: *mut JSRuntime, gc_threshold: size_t); + pub fn JS_RunGC(rt: *mut JSRuntime); } /// Custom allocator hooks so QuickJS can use the host (Rust/PSP) allocator