From ab8cdb07dece52f0226a1d0346157b6f172ed1ba Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 29 Dec 2022 18:54:53 +0000 Subject: [PATCH] gvariant: Remove some unnecessary type assertions on a hot path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While checking the validity of a `GVariantTypeInfo` is good, this code path is very hot, and I’ve never seen these assertions catch a bug in practice. Lean more towards the performance side of the performance/correctness tradeoff in this case, by removing the assertions here. They remain in place in a number of other `GVariantTypeInfo` code paths, so invalid `GVariantTypeInfo` pointers should hopefully still be caught quickly. Signed-off-by: Philip Withnall --- glib/gvarianttypeinfo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/glib/gvarianttypeinfo.c b/glib/gvarianttypeinfo.c index 2b310581c..4e2e9c5b4 100644 --- a/glib/gvarianttypeinfo.c +++ b/glib/gvarianttypeinfo.c @@ -247,8 +247,6 @@ g_variant_type_info_query (GVariantTypeInfo *info, guint *alignment, gsize *fixed_size) { - g_variant_type_info_check (info, 0); - if (alignment) *alignment = info->alignment;