1 Commits
Author SHA1 Message Date
zooqueenandHanzo Dev 0803549253 Start a plugin with no Sum from its own file, without copying it
openVerified copied every plugin binary into the instance's private
directory before exec, digest or not. The copy is what makes "what was
checked" and "what runs" one object, and it stays for a plugin with a
Sum. Without one nothing is checked, so the copy kept nothing equal:
the bytes at the path when it was taken are the bytes that ran. It cost
a full write of the binary on every lazy start (Hanzo's per-app
plugins are 24-145 MB), on whatever disk Dir sits on, and gave every
instance its own page cache.

A plugin with no Sum is now opened read-only and executed through that
descriptor. An embedded Bin is written once, under ForkLock (place),
and executed from there; before, it was written and then copied.

Benchmark_OpenBinary (the file handling alone, Apple M4 Max, APFS,
go1.27.1, -count=6, median):

  size     before     after
  16 MB    3.94 ms    0.026 ms
  48 MB   12.11 ms    0.026 ms
  144 MB  36.66 ms    0.026 ms

Benchmark_ColdStart (Load lazy, first request through the host, test
plugin padded to size, same host). On macOS the delta is far larger
than the copy itself: exec of a just-written file costs it more than
the bytes do. Expect the Linux gain to be the copy above, not this:

  binary     before      after
  15.8 MB   156.8 ms    7.8 ms
  47.8 MB   294.8 ms    7.1 ms
  143.8 MB  767.2 ms    7.3 ms

Co-authored-by: Hanzo Dev <[email protected]>
2026-10-15 05:43:43 -07:00