Files
ProxmoxVE/misc
MickLesk 2008b1b458 perf(misc): optimize network checks, IP detection, and subprocess chains
Files: install.func, alpine-install.func, core.func, api.func

Changes:
- install.func: Cache hostname -I result in setting_up_container() —
  eliminates 3 redundant calls (retry loop + post-check + display).
  Single awk extracts first IP from cached call.

- alpine-install.func: Cache ip addr result in setting_up_container() —
  replaces 3 identical 4-process pipelines (ip|grep|grep|awk|cut) with
  one call using single awk (sub+print in one pass).

- core.func get_lxc_ip(): Merge awk+cut into single awk (sub+print)
  for eth0 IPv4/IPv6 lookups. Replace tr|grep pipeline for IPv6 hostname
  fallback with bash array iteration (read -ra + for loop).

- api.func detect_gpu(): Merge 2x sed + cut into single sed -E + bash
  substring. detect_cpu(): Merge 4x sed + cut into single sed -E + bash
  substring. get_error_text(): Merge 2x sed into single sed -E.
  post_addon_to_api(): Replace 2x grep|cut|tr on /etc/os-release with
  single while-read loop (1 file read instead of 6 subprocess forks).
2026-03-23 20:44:47 +01:00
..