Files
mirror-3x-ui/internal/database/model
Sanaei e7717fb185 perf(inbounds): decode an inbound's settings once per save
Saving an inbound ran its settings through about twenty full decodes and
four encodes: every step of the save took the JSON as a string and parsed
all of it again, most of them to read one top-level key. With 100,000
clients the settings are 45 MB, and a form save that only changed the
remark took 5.4 s over HTTP.

The save now decodes the stored settings once, keeps the result through
the client steps (stored clients back, timestamps, Shadowsocks keys,
Vision flow) and encodes once, and it parses the typed client list once
per side instead of five times. Those steps are split into a core that
works on the decoded clients and the string wrapper their other callers
keep using.

The readers that only need one key no longer decode the client list:
the transport bits of a port check, the Shadowsocks method, and the
check for the VLESS encryption key that the core config must not carry.
The runtime inbound drops that key while it is decoded anyway, and the
node payload decodes its settings only when there are fallbacks to add.

Same save on the same data: 5.4 s -> 2.7 s over HTTP on a running panel,
with the stored settings byte-identical before and after.

Refs #7207
2026-11-26 12:10:11 +03:30
..