Re: g_hash_table_resize (#59026)
- From: Darin Adler <darin bentspoon com>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-devel-list gnome org, terra diku dk
- Subject: Re: g_hash_table_resize (#59026)
- Date: Sun, 19 Aug 2001 08:23:09 -0700
On Saturday, August 18, 2001, at 10:09 PM, Owen Taylor wrote:
+#define G_HASH_TABLE_RESIZE(hash_table) \
+ G_STMT_START { \
+ if (hash_table->nnodes < hash_table->size) \
+ { \
+ if (hash_table->size < 3 * hash_table->nnodes || \
+ hash_table->size <= HASH_TABLE_MIN_SIZE) \
+ goto __ok; \
+ } \
+ else \
+ { \
+ if (3 * hash_table->size > hash_table->nnodes || \
+ hash_table->size >= HASH_TABLE_MAX_SIZE) \
+ goto __ok; \
+ } \
+ g_hash_table_resize (hash_table); \
+ __ok: \
+ } G_STMT_END
I think you should try putting in two calls to g_hash_table_resize instead
of doing the goto. Many good compilers will still share the code for a
single function invocation, so you probably won't sacrifice code size, and
leaving out the gotos can give the optimizer a better chance to do a good
job.
-- Darin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]