Commit 83f080f
committed
Change ec2nvme-nsid to use Bash built-ins
This simple change cuts the runtime by more than half and CPU by almost a third. It also makes
the script more reliable when resources are constrained (the sort of situation where you might
suddenly attach more EBS NVMe volumes) and helps improve the performance of the early boot
process (initrd/initramfs), should you make these scripts part of that.
Performance before:
$ time bash -c 'for i in $(seq 1 10000); do bash ./ec2nvme-nsid nvme0n1234234p2 > /dev/null; done'
bash -c 38.00s user 90.67s system 92% cpu 2:18.43 total
Performance after:
$ time bash -c 'for i in $(seq 1 10000); do bash ./ec2nvme-nsid nvme0n1234234p2 > /dev/null; done'
bash -c 12.61s user 27.56s system 66% cpu 1:00.26 total
Signed-off-by: Keith Gable <gablk@amazon.com>1 parent 220d932 commit 83f080f
2 files changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
0 commit comments