quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: Talking about PSP: Internals
Date Thu, 10 Apr 2003 16:04:07 GMT

On Thu, 10 Apr 2003, David Fraser wrote:

> >- There are more options in C.  Had I originally written this in python,
> >I might not be keen on porting it to C.  But since I have the parser
> >working quite well in C (reliably), it seems like less effort to just
> >flatten out thread issues, than port it to python, and deal with a whole
> >host of other issues.  Especially if in a year it turns out I need to
> >port it back to C for unforeseen reasons. :)
> >
> Of course, now that Jack has rewritten it in Python, this doesn't
> neccessarily hold ... This would actually be one of the major advantages
> of having it in Python, the ease of making any changes.

In this paper http://www.modpython.org/python10/ I have a small section on
Python vs C as it applies to mod_python and gist of it is that C pretty
much wins over Python every time.

I should stress that the above is specific to mod_python, not my view in
general. Mod_python is an application that is intended to run in an
environment where performance is critical. Of course it is also used in
situations where performance isn't critical, but for those folks that are
after performance and scalability, I'd like to assure as much as possible
that performance or scalability has not been sacrificed in any way, even
at the expense of lesser hackability.

Being a tool for developers, mod_python's interface has to be well defined
and rigid, so a lot of consideration is given to how things would work and
they are rarely changed after being implemented. When it comes to parsing,
I think once we decide on the PSP syntax and release it, it is not going
to change a lot in the future. So the value of hackability isn't all that

On the parsing vs running cached Python bytecode - even though there may
be cases where not a lot of parsing is going on, we have to do it with the
assumption that there will be some with a *whole lot* of parsing.

One scenario is a gigantic site - if you have handreds of Mb of psps pages
all being randomly and uniformly accessed (think web-hosting with tons of
virtual hosts), caching is next to useless. (which is why I think *.pyc
style thing, or "Compiled PSP" should be given consideration)

Another thing to keep in mind is that in certain cases the PSP code will
be dynamic. We're not at that point yet, but PSP can be implemented as a
filter where the input to it may be produced by abother application.

Probably, if I was working on psp, I would start out with a Python
implementation, simply because I am not that experienced when it comes to
parsing. But if Sterling already has a flex implementation, and is farily
confident that it is good, I think moving to Python would be a step

BTW - I very much appreciate people posting to this list and having a
discussion and Jack taking the time to support his point with code, I must
say the list has been somewhat lethargic lately, and that is not good.


View raw message