M3U8Decoder
M3U8Decoder copied to clipboard
Performance Issue
Hi. First of all, thanks for your contribution to the open source family 🫡
The package is very useful for small playlists but for large ones; I cannot say the same for the playlist I have.
It consists of 194.918 (EXTINF, URI) pairs and single EXTM3U entry with 22,1 MB in size.
Decoding it takes around 5.5 minutes with your package while VLC Player decodes in ~2 minutes. But the blowminding thing is a snippet from this medium post decodes the same playlist instantly (1.3 seconds). Of course the snippet does nothing but parsing it, no custom tags or any other features but instant vs 5.5 minutes
is something very serious.
I think you should re-think about how you construct things.
Good luck ✌️
Hi @anelad!
Thanks for your notice about the performance issues. Could you provide a link to your large m3u8 file to test and compare with other parsers?
Of course I had to change the url, username and password so links are dead.
If you are on a Mac, OS won't open the file since it's origin is not known. You can "open anyway" from Settings -> Privacy & Security
. I don't know about Windows or Linux distributions though.
Good luck!
Hi @anelad!
There is new 2.0.0 version of the tool with parsing optimization. This version has predefined segments
property to deal with Media Segments now, e.g.:
struct MediaPlaylist: Decodable {
let segments: [MediaSegment]
}
let playlist = try M3U8Decoder().decode(MediaPlaylist.self, from: url)
I've got the following results:
- Mac M1: ~3-5 secs
- iPhone 11: ~5-6 mins
Hello again @ikhvorost,
Thanks for the update. Currently I have some health issues but I'll give it a look as soon as possible.
Have a good day 👋
Can I work on this issue? kindly assign it to me