Commit ca6bbf1
authored
Improve performance of Tar library (#74281)
* Avoid unnecessary byte[] allocations
* Remove unnecessary use of FileStreamOptions
* Clean up Dispose{Async} implementations
* Clean up unnecessary consts
Not a perf thing, just readability.
* Remove MemoryStream/Encoding.UTF8.GetBytes allocations, unnecessary async variants, and overhaul GenerateExtendedAttributesDataStream
* Avoid string allocations in ReadMagicAttribute
* Avoid allocation in WriteAsOctal
* Improve handling of octal
* Avoid allocation for version string
* Removing boxing and char string allocation in GenerateExtendedAttributeName
* Fix a couple unnecessary dictionary lookups
* Replace Enum.HasFlag usage
* Remove allocations from Write{Posix}Name
* Replace ArrayPool use with string.Create
* Replace more superfluous ArrayPool usage
* Remove ArrayPool use from System.IO.Compression.ZipFile
* Fix inverted condition
* Use generic math to parse octal
* Remove allocations from StringReader and string.Split
* Remove magic string allocation for Ustar when not V7
* Remove file name and directory name allocation in GenerateExtendedAttributeName1 parent 729844a commit ca6bbf1
File tree
12 files changed
+511
-576
lines changed- src/libraries
- Common/src/System/IO
- System.Formats.Tar/src
- Resources
- System/Formats/Tar
- System.IO.Compression.ZipFile/src/System/IO/Compression
12 files changed
+511
-576
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| 34 | + | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 38 | + | |
45 | 39 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 40 | + | |
49 | 41 | | |
50 | 42 | | |
51 | | - | |
52 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
258 | 261 | | |
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 191 | + | |
195 | 192 | | |
196 | 193 | | |
197 | 194 | | |
| |||
Lines changed: 15 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 18 | | |
24 | 19 | | |
25 | 20 | | |
| |||
283 | 278 | | |
284 | 279 | | |
285 | 280 | | |
286 | | - | |
287 | | - | |
288 | | - | |
| 281 | + | |
289 | 282 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 283 | + | |
299 | 284 | | |
300 | | - | |
| 285 | + | |
| 286 | + | |
301 | 287 | | |
302 | | - | |
| 288 | + | |
303 | 289 | | |
304 | 290 | | |
305 | 291 | | |
| |||
339 | 325 | | |
340 | 326 | | |
341 | 327 | | |
342 | | - | |
343 | | - | |
344 | | - | |
| 328 | + | |
345 | 329 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
| 330 | + | |
355 | 331 | | |
356 | | - | |
| 332 | + | |
| 333 | + | |
357 | 334 | | |
358 | | - | |
| 335 | + | |
359 | 336 | | |
360 | 337 | | |
361 | 338 | | |
| |||
365 | 342 | | |
366 | 343 | | |
367 | 344 | | |
368 | | - | |
| 345 | + | |
369 | 346 | | |
370 | 347 | | |
371 | 348 | | |
372 | 349 | | |
373 | | - | |
374 | | - | |
| 350 | + | |
| 351 | + | |
375 | 352 | | |
376 | 353 | | |
377 | | - | |
| 354 | + | |
378 | 355 | | |
379 | | - | |
| 356 | + | |
380 | 357 | | |
381 | 358 | | |
382 | 359 | | |
| |||
0 commit comments