Skip to content
Commit 95c872c1 authored by Andrew Jeffery's avatar Andrew Jeffery
Browse files

oem: ibm: Use `truncate(1)` to create NVRAM related files



Use of `dd(1)` results in back-to-back `read(2)` and `write(2)` syscalls;
the performance of `dd(1)` is O(n) with respect to the file size. Poor
choice of the `bs=` parameter to `dd(1)` can significantly amplify the
amount of syscalls required to achieve the task.

By contrast, `truncate(1)` generally invokes a single syscall, either
`truncate(2)` or `ftruncate(2)`. As a consequence, `truncate(1)` is O(1)
with respect to file size.

Switch to `truncate(1)` to improve runtime efficiency of the scripts.

Signed-off-by: default avatarAndrew Jeffery <andrew@aj.id.au>
Change-Id: I69dd925f36e733fc2a1ee71cb8354ee04ee8871b
parent 488f19d0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment