Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 2/3] doc/dict2: Add doc and api change for AVDictionary2
Date: Wed, 16 Apr 2025 23:48:09 +0200
Message-ID: <20250416214809.GO4991@pb2> (raw)
In-Reply-To: <fed846502d637bc6ecf9e1d27e71a1d8a2168868.1744470718.git.ffmpegagent@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2618 bytes --]

Hi softworkz

I think we should use AI to support us and reduce the workload
on people.
I think this here cost you money and iam not sure this isnt
adding workload and maybe even increased disagreements between
people

can you get AI to do something nooone else is working on ?
or to support someone on what she is working on. This here
is a bit more a opposition submission.
Id love it if AI would submit bugfixes to my code for example
or if it would submit patches improving my code

Or maybeit could fix a random ticket chance of collision
with a human is pretty low

thx

On Sat, Apr 12, 2025 at 03:11:57PM +0000, softworkz wrote:
[...]
> +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       |

One of the issues with AVDictionary is that its very slow with crafted
data, Classic hash tables dont improve that.
Which is one reason why i did go for the tree and not a hash table
also AV_DICT_IGNORE_SUFFIX, is not hash table friendly and not supported
by this


> +| 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

I dont think this is correct, not that this matters

also another key question, who would maintain AI generated code ?
and for the specific case of string based has tables, i wager a bet
that theres some maintained code somewhere on github.

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

  reply	other threads:[~2025-04-16 21:48 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 ` [FFmpeg-devel] [PATCH 2/3] doc/dict2: Add doc and api change for AVDictionary2 softworkz
2025-04-16 21:48   ` Michael Niedermayer [this message]
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=20250416214809.GO4991@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /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