Commit b82ae38
authored
perf(core): optimize async operation & progress events (#23)
perf(core)!: optimize download pipeline, progress events, and stream I/O
- lower CPU load by ~35% by replacing `pretty-bytes` and `pretty-ms` with optimized in-repo formatters
- lower event-loop load and context switching by ~60% by replacing the old write path with queued/debounced disk writes via `WriteQueue`
- reduce network file-engine event overhead by ~10% with debounced progress/event emission
- reduce CLI engine-order calculation overhead by ~5% with cached CLI calculations
- replace `eventemitter3`/`chalk` with a lighter in-repo `EventEmitter`, fast formatters, and `ansis`
- add range-aware per-part downloads, stronger range validation, stream watchdog/retry handling, and renewed download URL support
- improve CLI/save-path handling and filename detection, including the `--save` directory fix
- expand regression coverage with a local HTTP test server for redirects, ranges, content-length mismatches, pause/resume, and error propagation
Benchmarks: https://ido-pluto.github.io/ipull-speed-test/
Benchmarks source: https://github.com/ido-pluto/ipull-speed-test
BREAKING CHANGE: minimum supported Node.js version is now 20.
BREAKING CHANGE: CLI `-st` shortcut was removed; use `--style`.
BREAKING CHANGE: automatic file-name resolution changed to better capture names from URLs and `content-disposition`, so resolved output file names may differ from previous releases.
BREAKING CHANGE: `pause()` now closes active connections and `resume()` reopens them.
BREAKING CHANGE: `start` and `finished` events are now emitted for `Existing` and `Cloned` download edge cases.
BREAKING CHANGE: public download metadata moved to a per-part model: `DownloadFilePart.size` was replaced by `remoteFileSize` and `downloadSize`, and per-part settings such as `parallelStreams` now live on each part instead of resumable progress metadata.
BREAKING CHANGE: TypeScript event APIs on exported download engines are now stricter, so arbitrary string event names are no longer accepted by default on typed emitters.
Fixes #19
Fixes #211 parent 39e7a87 commit b82ae38
76 files changed
Lines changed: 5971 additions & 4427 deletions
File tree
- .github/workflows
- src
- cli
- utils
- download
- download-engine
- download-file
- download-programs
- engine
- error
- streams
- download-engine-fetch-stream
- errors
- utils
- download-engine-write-stream
- utils
- utils
- transfer-visualize
- transfer-cli
- multiProgressBars
- progress-bars
- utils
- utils
- test
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
0 commit comments