mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-03 06:22:15 +02:00
Playlist Update Optimization: Reduced Memory Usage
An optimization has been introduced to reduce memory consumption during playlist updates.
Overview
Previously, provider playlists were fully loaded into memory during the update process. For large playlists (e.g. hundreds of thousands of entries or multiple providers), this could result in significant RAM usage.
With the new implementation, it is now possible to optionally read provider playlists directly from disk instead of keeping them entirely in memory.
How It Works
- users can configure whether:
- Provider playlists are loaded into memory (previous behavior), or
- Provider playlists are streamed to/from disk to minimize RAM usage.
Processing remains sequential and batch-based, ensuring identical functional behavior.
This approach significantly lowers peak memory usage, especially on systems with limited resources.
Benefits
- Reduced peak RAM consumption during playlist updates
- Better scalability for large playlists and multiple providers
- Full backward compatibility
Trade-offs / Drawbacks
- Increased processing time due to reduced in-memory caching
- Higher disk I/O usage, especially for large or fragmented playlists
- Performance depends more strongly on disk speed (Nvme SSD, HDD)
- Slightly increased CPU overhead due to repeated parsing and deserialization
- Not optimal for environments where fast updates are more important than memory usage
Recommendation
- Use in-memory mode for systems with sufficient RAM and a focus on update speed
- Use disk-based mode for large playlists, multiple providers, or memory-constrained environments
This commit is contained in:
@@ -5,6 +5,7 @@ use shared::utils::{default_supported_video_extensions, extract_id_from_url, Str
|
||||
use std::borrow::BorrowMut;
|
||||
use tokio::io::AsyncBufReadExt;
|
||||
use indexmap::IndexMap;
|
||||
use shared::concat_string;
|
||||
|
||||
// other implementations like calculating text_distance on all titles took too much time
|
||||
// we keep it now as simple as possible and less memory intensive.
|
||||
@@ -13,7 +14,7 @@ fn get_title_group(text: &str) -> String {
|
||||
let parts = alphabetic_only.split_whitespace();
|
||||
let mut combination = String::new();
|
||||
for p in parts {
|
||||
combination = format!("{combination} {p}").trim().to_string();
|
||||
combination = concat_string!(&combination, " " , p);
|
||||
if combination.len() > 2 {
|
||||
return combination;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user