httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
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:

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. 

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

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[			\

/* 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 {

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.


View raw message