From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 1C6264CF7B
	for <ffmpegdev@gitmailbox.com>; Tue, 15 Apr 2025 19:06:43 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 35FC5687CCB;
	Tue, 15 Apr 2025 22:06:40 +0300 (EEST)
Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net
 [217.70.183.193])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE0BF687CCB
 for <ffmpeg-devel@ffmpeg.org>; Tue, 15 Apr 2025 22:06:33 +0300 (EEST)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 10EBD439F0
 for <ffmpeg-devel@ffmpeg.org>; Tue, 15 Apr 2025 19:06:32 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1744743993;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=XN6uu4QhFWEy3r0iR4ekglVp/Id422jQ1QFwUkj2Zg8=;
 b=QySgg9MrnhqAWCHuhSz6L0ruMPa/lD+nuB3BSIoqUjaqgtG1jyRkj49SaKYlPMsee1NNdD
 yP5QZVf4GFzjJN/dDqpd7MijUSQBIn6Rb80n4mTo+XY2iNXA6V7U9Tg0T5nQ72dB7Q3/Ba
 NiYinDBW/9j6y5IO/i2pFom5CPboESC9QTusp6/toaoe8/NvcB2ifKk9rcS5YMq0PO0Qrx
 Qj0j2MXDfMk8JkkeRg0UHDTWIq5/d63EalH8c6IZWw05FAL/rS2ALd7GcxnB0CieeI/M8h
 BCiBQiByQ2PzDuxqk2f9cEnJ2Lu2qLbuCu+Pxg7olT6pgawmdPCJj6hV5WoMhA==
Date: Tue, 15 Apr 2025 21:06:31 +0200
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250415190631.GS4991@pb2>
References: <20250415181433.530161-1-michael@niedermayer.cc>
 <20250415181433.530161-5-michael@niedermayer.cc>
 <Z_6pR62oq4act_V1@phare.normalesup.org>
MIME-Version: 1.0
In-Reply-To: <Z_6pR62oq4act_V1@phare.normalesup.org>
X-GND-State: clean
X-GND-Score: -70
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdegvdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeelkeeggfffiedufeejueffjeduhedttdduledtheevveevtdeiueelhfdtuedtkeenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH v2 5/6] libavutil: Add AVMap
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: multipart/mixed; boundary="===============3854967622608839635=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250415190631.GS4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============3854967622608839635==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="DvbsTYwJ3ba/VxrE"
Content-Disposition: inline


--DvbsTYwJ3ba/VxrE
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Nicolas

On Tue, Apr 15, 2025 at 08:45:27PM +0200, Nicolas George wrote:
> Michael Niedermayer (HE12025-04-15):
> > +AVMap *av_map_new(AVMapCompareFunc cmp_keyvalue, AVMapCopyFunc copy, A=
VMapFreeFunc freef)
> > +{
> > +    AVMap *s =3D av_mallocz(sizeof(*s));
> > +    if (!s)
> > +        return NULL;
>=20
> Please no.
>=20
> The ability to allocate on stack including room for a few values is more
> important than any performance enhancement for large maps.

Where exactly would that benefit FFmpeg ?
Dictionaries generally are used to move stuff aorund, like metadata or
options.
Or may be used in the future to keep track of some mappings like
timestamps to file positions during demuxing or muxing
Or maybe codecs/formats lookup from name

None of these are confined to a single local function


>=20
> > +        AVMap *set =3D av_map_new(our_cmp[settype], NULL, NULL);
>=20
> =E2=80=A6 should be=C2=A0:
>=20
> 	AVMap set =3D av_map_create(cmp, NULL, NULL);
>=20
> or=C2=A0:
>=20
> 	AVMap set;
> 	av_map_init(&set, sizeof(set), cmp, NULL, NULL);

i like av_map_new() because "new" is short
and sizeof(AVMap) is not public API

thx

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

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin

--DvbsTYwJ3ba/VxrE
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ/6uNAAKCRBhHseHBAsP
q/uCAJ0RAucUdLIk0j2xxMx6EKZjhXBCawCeMbR/9QjnXMyZixY57MSRSLCn8dQ=
=ZU8m
-----END PGP SIGNATURE-----

--DvbsTYwJ3ba/VxrE--

--===============3854967622608839635==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============3854967622608839635==--