From: softworkz <ffmpegagent@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: softworkz <softworkz@hotmail.com> Subject: [FFmpeg-devel] [PATCH 2/3] doc/dict2: Add doc and api change for AVDictionary2 Date: Sat, 12 Apr 2025 15:11:57 +0000 Message-ID: <fed846502d637bc6ecf9e1d27e71a1d8a2168868.1744470718.git.ffmpegagent@gmail.com> (raw) In-Reply-To: <pull.64.ffstaging.FFmpeg.1744470718.ffmpegagent@gmail.com> From: softworkz <softworkz@hotmail.com> Signed-off-by: softworkz <softworkz@hotmail.com> --- doc/APIchanges | 3 +++ doc/dict2.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 doc/dict2.md diff --git a/doc/APIchanges b/doc/APIchanges index 65bf5a9419..1e0d47083b 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2025-04-12 - xxxxxxxxxx - lavu 60.02.100 - dict2.h + Add AVDictionary2. + 2025-04-07 - 19e9a203b7 - lavu 60.01.100 - dict.h Add AV_DICT_DEDUP. diff --git a/doc/dict2.md b/doc/dict2.md new file mode 100644 index 0000000000..65147dd4ba --- /dev/null +++ b/doc/dict2.md @@ -0,0 +1,44 @@ +# AVDictionary2 - High Performance Dictionary Implementation + +AVDictionary2 is a hash table-based key-value dictionary implementation that provides significant performance improvements over the original AVDictionary implementation. + +## Overview + +The implementation uses: + +- Hash table with chaining for collision resolution +- Automatic table resizing when load factor exceeds 0.75 +- Optimized key/value storage management +- Efficient iteration through entries + +## Performance + +### Time Complexity +AVDictionary2 offers substantial time complexity improvements: + +| Operation | AVDictionary (Linked List) | AVDictionary2 (Hash Table) | +|-----------|----------------------------|----------------------------| +| Insert | O(n)* | O(1) avg, O(n) worst | +| Lookup | O(n) | O(1) avg, O(n) worst | +| Iteration | O(n) | O(n) | + +*Where n is current dictionary size due to duplicate checking + +### Memory Characteristics + +**Original AVDictionary (dict.c)** +- 2 allocations per entry (key + value string duplicates) +- Dynamic array with O(log n) reallocations +- Total: ~2n + log₂(n) allocations for n entries + +**AVDictionary2 (dict2.c)** +- 3 allocations per entry (struct + key + value duplicates) +- Hash table with O(log n) bucket table reallocations +- 2 initial allocations (dict struct + initial table) +- Total: ~3n + 2 + log₂(n) allocations for n entries + +**Key Differences:** +1. AVDictionary2 has faster O(1) average case operations despite 50% more allocations +2. Both handle growth with logarithmic reallocations but with different base structures +3. Real-world benchmarks show dramatic speed improvements outweigh allocation costs + -- ffmpeg-codebot _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-04-12 15:12 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-04-12 15:11 [FFmpeg-devel] [PATCH 0/3] avutil/dict2: Add AVDictionary2 with hash-based lookup ffmpegagent 2025-04-12 15:11 ` [FFmpeg-devel] [PATCH 1/3] " softworkz 2025-04-16 21:24 ` Michael Niedermayer 2025-04-16 22:38 ` softworkz . 2025-04-12 15:11 ` softworkz [this message] 2025-04-16 21:48 ` [FFmpeg-devel] [PATCH 2/3] doc/dict2: Add doc and api change for AVDictionary2 Michael Niedermayer 2025-04-16 22:43 ` softworkz . 2025-04-16 23:15 ` softworkz . 2025-04-16 23:40 ` Michael Niedermayer 2025-04-17 22:38 ` softworkz . 2025-04-19 2:28 ` Michael Niedermayer 2025-04-19 13:43 ` softworkz . 2025-04-20 20:37 ` Michael Niedermayer 2025-04-12 15:11 ` [FFmpeg-devel] [PATCH 3/3] tests/dict2: Add tests and benchmark " softworkz 2025-04-14 11:02 ` [FFmpeg-devel] [PATCH 0/3] avutil/dict2: Add AVDictionary2 with hash-based lookup Nicolas George 2025-04-14 11:50 ` softworkz . 2025-04-14 13:21 ` softworkz .
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=fed846502d637bc6ecf9e1d27e71a1d8a2168868.1744470718.git.ffmpegagent@gmail.com \ --to=ffmpegagent@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ --cc=softworkz@hotmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git