⚡ Improve performance by batching root commands in keybox update
💡 **What:** Batched the `mkdir -p` command and the subsequent conditional backup logic (`if [ -f ... ]; then mv ...; fi`) into a single `su -c sh` session using a piped block.
🎯 **Why:** To reduce process creation overhead associated with invoking `su` multiple times on Android. Each `su` call spawns a new process and context, which is expensive.
📊 **Measured Improvement:**
Created a benchmark script `bench.sh` simulating `su` overhead with a 10ms delay.
- **Baseline:** ~54ms (3 `su` calls)
- **Optimized:** ~27ms (1 `su` call)
- **Improvement:** ~50% reduction in wall clock time in the simulated environment.
Verified syntax with `bash -n`.
---
*PR created automatically by Jules for task [13022275925596462014](https://jules.google.com/task/13022275925596462014) started by @tryigit*
合并状态:未合并 2 条评论