Commit 8f9f3d8
committed
Improve quoting performance
If features or users have added a large number of files or directories
to pack into an image, then quoting a very long string takes too much
time.
Quoting variables is necessary for the correct processing of paths with
spaces.
The problem is that if we need to process a very large string,
character-by-character parsing takes a long time. It so happens that
there is no quick way to parse a string character by character in the
POSIX shell. But in bash, such a way exists.
Since we always use bash, the quoting process can be significantly
accelerated by simply reading a single character in a string.
Before:
[ 2.55ms ] Config file: /etc/initrd.mk
[ 5.3m ] Used features: runtime add-modules add-udev-rules cleanup compress depmod-image gpu-drm locales plymouth rdshell rootfs system-glibc ucode
[ 5.3m ] Unpacked size: 36M
[ 5.3m ] Image size: 16M
[ 5.3m ] Image is saved as /boot/initrd-6.16.0.img
After:
[ 2.47ms ] Config file: /etc/initrd.mk
[ 9.43s ] Used features: runtime add-modules add-udev-rules cleanup compress depmod-image gpu-drm locales plymouth rdshell rootfs system-glibc ucode
[ 9.43s ] Unpacked size: 36M
[ 9.44s ] Image size: 16M
[ 9.49s ] Image is saved as /boot/initrd-6.16.0.img
Signed-off-by: Alexey Gladkov <[email protected]>1 parent 226e74e commit 8f9f3d8
1 file changed
+83
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
18 | 96 | | |
19 | 97 | | |
20 | 98 | | |
| |||
34 | 112 | | |
35 | 113 | | |
36 | 114 | | |
37 | | - | |
| 115 | + | |
38 | 116 | | |
39 | 117 | | |
40 | 118 | | |
| |||
113 | 191 | | |
114 | 192 | | |
115 | 193 | | |
116 | | - | |
| 194 | + | |
117 | 195 | | |
118 | 196 | | |
119 | 197 | | |
| |||
158 | 236 | | |
159 | 237 | | |
160 | 238 | | |
161 | | - | |
| 239 | + | |
162 | 240 | | |
163 | 241 | | |
164 | 242 | | |
| |||
184 | 262 | | |
185 | 263 | | |
186 | 264 | | |
187 | | - | |
| 265 | + | |
188 | 266 | | |
189 | 267 | | |
190 | 268 | | |
| |||
209 | 287 | | |
210 | 288 | | |
211 | 289 | | |
212 | | - | |
| 290 | + | |
213 | 291 | | |
214 | 292 | | |
215 | 293 | | |
| |||
0 commit comments