On Wed, 27 Jun 2001, Brian Pane wrote:
> +/* Information to which an extension can be mapped
> + */
> +typedef struct extension_info {
> + char *forced_type; /* Additional AddTyped stuff */
> + char *encoding_type; /* Added with AddEncoding... */
> + char *language_type; /* Added with AddLanguage... */
> + char *handler; /* Added with AddHandler... */
> + char *charset_type; /* Added with AddCharset... */
> +} extension_info;
> +
looks like you're causing the data structure to use a fair amount more
memory ... or at least spreading out the data onto more cache lines.
you've got 5 pointers per extension when only 1 is typically needed right?
an alternative is to make the "extension info" part of the key to the hash
table. so rather than just using the extension to look up an
extension_info and then extract the pointer field_name, you use
(extension, field_name) to look up a pointer.
you could do this by prepending some constant to the extension, like "0" =
forced_type, "1" = encoding_type, ...
(or perhaps APR hash tables are generic enough that you can use different
keys other than strings, i haven't looked.)
-dean