Re: g_type_instance_is_a (was Cairo 1.3 performance loss)
- From: Nick Schermer <nick xfce org>
- To: Matthias Clasen <mclasen redhat com>
- Cc: performance-list <performance-list gnome org>
- Subject: Re: g_type_instance_is_a (was Cairo 1.3 performance loss)
- Date: Thu, 25 Jan 2007 15:55:15 +0100
On Thu, 25 Jan 2007 09:33:37 -0500, Matthias Clasen <mclasen redhat com> wrote:
>> similarly, this only calls:
>>
>> g_return_if_fail (GTK_IS_WIDGET (widget));
>>
>> perhaps it just happens millions of times; odd.
>>
I know the g_return check are useful (and needed) for developers, but they are not important for users when the application is stable. So maybe it's an idea to add a macro for disabling the check when you compile gtk without debug?
#ifndef NDEBUG
#define _gtk_assert(expr) g_assert (expr)
#define _gtk_assert_not_reached() g_assert_not_reached ()
#define _gtk_return_if_fail(expr) g_return_if_fail (expr)
#define _gtk_return_val_if_fail(expr, val) g_return_val_if_fail (expr, (val))
#else
#define _gtk_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
#define _gtk_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
#define _gtk_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
#define _gtk_return_val_if_fail(expr, val) G_STMT_START{ (void)0; }G_STMT_END
#endif
Maybe it's just an crazy idea, but if you want to get rid of all the checks, this might be the solution...
Greets,
Nick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]