1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-21 15:23:13 +00:00
yt-dlc/youtube_dlc
Jody Bruchon ecdec1913f Keep download archive in memory for better performance
The old behavior was to open and scan the entire archive file for
every single video download. This resulted in horrible performance
for archives of any remotely large size, especially since all new
video IDs are appended to the end of the archive. For anyone who
uses the archive feature to maintain archives of entire video
playlists or channels, this meant that all such lists with newer
downloads would have to scan close to the end of the archive file
before the potential download was rejected. For archives with tens
of thousands of lines, this easily resulted in millions of line
reads and checks over the course of scanning a single channel or
playlist that had been seen previously.

The new behavior in this commit is to preload the archive file
into a binary search tree and scan the tree instead of constantly
scanning the file on disk for every file. When a new download is
appended to the archive file, it is also added to this tree. The
performance is massively better using this strategy over the more
"naive" line-by-line archive file parsing strategy.

The only negative consequence of this change is that the archive
in memory will not be synchronized with the archive file on disk.
Running multiple instances of the program at the same time that
all use the same archive file may result in duplicate archive
entries or duplicated downloads. This is unlikely to be a serious
issue for the vast majority of users. If the instances are not
likely to try to download identical video IDs then this should
not be a problem anyway; for example, having two instances pull
two completely different YouTube channels at once should be fine.

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
2020-09-17 14:22:07 -04:00
..
downloader [skip travis] renaming 2020-09-02 20:25:25 +02:00
extractor [hotstar] regex fix 2020-09-17 14:00:03 +02:00
postprocessor Merge branch 'ext/remuxe-video' of https://github.com/Zocker1999NET/youtube-dl into Zocker1999NET-ext/remuxe-video 2020-09-16 10:30:38 +02:00
__init__.py [Core] hls manifests, dynamic mpd 2020-09-16 13:00:41 +02:00
__main__.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
aes.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
cache.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
compat.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
jsinterp.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
options.py [Core] hls manifests, dynamic mpd 2020-09-16 13:00:41 +02:00
socks.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
swfinterp.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
update.py [skip travis] renaming 2020-09-02 20:25:25 +02:00
utils.py Merge branch 'ytdl-org-master' 2020-09-12 05:08:57 +02:00
version.py bump version 2020.09.16 2020-09-16 13:55:35 +02:00
YoutubeDL.py Keep download archive in memory for better performance 2020-09-17 14:22:07 -04:00