Commit b384a30
committed
perf(@angular/cli): optimize cache size calculation in
This commit significantly improves the performance and reliability of the cache size calculation for the `ng cache info` command.
The previous implementation performed sequential `fs.stat` calls, which was inefficient for directories with many files. The new implementation introduces several key improvements:
- **Parallel I/O:** `fs.stat` calls are now executed in parallel to dramatically speed up the calculation.
- **Batching:** To prevent file descriptor exhaustion (`EMFILE` errors) on large caches, the parallel operations are processed in controlled batches.
- **Type Safety:** The directory traversal loop was refactored to remove a non-null assertion, making the code safer and more robust.
- **Error Handling:** Unreadable directories are now handled gracefully with a warning instead of failing silently.ng cache info command1 parent 5063671 commit b384a30
1 file changed
Lines changed: 26 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
| 88 | + | |
83 | 89 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 90 | + | |
| 91 | + | |
88 | 92 | | |
| 93 | + | |
| 94 | + | |
89 | 95 | | |
| 96 | + | |
90 | 97 | | |
91 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
92 | 107 | | |
93 | 108 | | |
94 | 109 | | |
| |||
0 commit comments