emarsden / dash-mpd-rs

Rust library for parsing, serializing and downloading media content from a DASH MPD manifest.
MIT License
70 stars 22 forks source link

Pre-compile xs_duration regex for use in parsing MPDs #44

Closed sbuzzard closed 7 months ago

sbuzzard commented 7 months ago

We were doing some perf and memory testing / tuning of our application and noticed a lot of small allocations and overhead of compiling the regex for xs_duration (we have a lot of streams currently processing MPD updates every ~2s; we're not using fetch, but potentially the template url resolution there could benefit from this too though that's a much simpler regex). Moving it to a static improved things a good deal. This does introduce a dependency on lazy_static crate but there was already a transient dependency on it. Let me know what you think.

emarsden commented 7 months ago

Excellent, thanks! I'll look at this also for the fetch module, though that already has significant memory allocation requirements for downloading segments.