httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [2.0] API extension mechanism (updated proposal)
Date Sat, 03 May 1997 11:38:34 GMT
On Fri, 2 May 1997, Ian Kluft wrote:
>    http://www.employees.org/~ikluft/apache/api2.0.html

People will still be able to build a binary distribution (such as
Stronghold) that will allow people to compile and link in their own
modules, right?  It looks like this is possible provided people don't want
to change the api-config. 

<http://www.arctic.org/~dgaudet/patches/apache-1.2-run_method-performance.patch>
I'm seeing a noticeable gain from this patch -- run_method down from 7 us
per call to 1 us per call (6.7% cpu time to .91% cpu time).  run_method is
called at least 7 times per hit, and something like 10 times per hit on
negotiated content.  How easy is a similar optimization going to be? 

It's quite late so I might have this next part all wrong, I think there's
far more that can be computed at compile time using the preprocessor.
For example we can use preprocessor tricks to get us properly casted

Consider class lookup, and assume we know we're invoking a method on an
object of class lookup.  After all, in the lookup case itself we should
know that we've go an object that inherits lookup...  That would be
something that's decided on during server configuration.  So it sucks to
pay for the binary search all the time (and the extra function invocation,
and the va_args manipulation, and lose the ability to have leaf functions
omit-frame-pointer...).

I'm thinking of something along these lines.

#define api_run_static(object,class_name,method_name)		\
	(*(cast_##class_name##_##method_name)			\
	    ((object)->class->method_tbl[			\
		api_static_method_##class_name##_##method_name].func))

/* function prototypes for class lookup */
#define cast_lookup_dump	(void (*)(dump prototype))
#define cast_lookup_init	(void (*)(init prototype))
...
#define cast_lookup_get		(char *(*)(request_rec *r, const char *key))
...

/* indicies into api_class_lookup__methods */
enum {
        api_static_method_lookup_init,
        api_static_method_lookup_create_dir_config,
        api_static_method_lookup_merge_dir_config,
        api_static_method_lookup_create_server_config,
        api_static_method_lookup_merge_server_config,
        api_static_method_lookup_open,
        api_static_method_lookup_close,
        api_static_method_lookup_get,
        api_static_method_lookup_put
};

Then invoke api_run_static(foobar,lookup,get)(r, key).

To do (single) inheritance we just ensure that the parent class' methods
are listed first, and in the same order in the child class.

Ack, it's still expensive.

Dean


Mime
View raw message