Am 08.07.2012 00:23, wrote RjOllos:
> Hi Steffen,
> 
> Do you have any thoughts in the advantages or disadvantages of the
> ITemplateStreamFilter vs IRequestFilter implementation? They seem
> pretty equivalent to me. Perhaps the latter would give better
> performance in some situations.
> 

Well, I had to think about this recently, but looking at the API, I
could see their distinct use cases:

ITemplateStreamFilter
 * just one method, straight: manipulate template content
 * since you return just the Genshi XHTML stream, you can't do much more

IRequestFilter
 * advanced, two times interception, allows to
  (pre_process stage)
  * redirect requests
  (post_process stage)
  * not just alter but totally exchange page template
  * alter corresponding data

IMHO, all implementations should be coded for efficiency, so test simple
and early, if they should be invoked, and return instantly, if not.

Performance-wise I prefer the ITemplateStreamFilter due to simplicity
and one-time-per-request action, if it could do the job. Something like
like DOM element-tree manipulation, that don't require additional data
changes. IRequestFilter is definitely more versatile, powerful, thus
should be a bigger burden to response time. But this is an educated
guess only, can't give profiling results to ultimately proof my point.

Yours,

Steffen Hoffmann

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to