[Zope] Performance boost

Robert Leftwich robert@leftfieldcorp.com
Sat, 25 Sep 1999 10:24:29 +1000


Note that the default installation (at least on NT) has the -D switch in
the start.bat, so if you use external DTML files extensively (via
HTMLFile) then a fairly significant performance boost can be gained by
removing the -D option.

Robert Leftwich

PS Thanks for the info - as it turned out, I decided to do my basic
version checking on product startup by reading each DTML file and
extracting the version string which is embedded as a comment on the
first line of each file. This eliminates the problem in my original
implementation where the file is version checked every time the DTML
code is run, which is an unnecessary performance hit.
I was very surprised at how quickly the code ran, it takes less than 1
second on my dual PII-350 NT machine to open each file, read the first
line, break the line into the required pieces, call the version check
function and close the file for each of the 146 dtml files that I am
currently using !

PPS Out of interest, is there a way for the name of the HTMLFile object
to be accessed in the actual dtml code in that file without knowing the
variable name to which it is assigned ? Otherwise, you have a potential
maintenance problem with having to change the name in the .py and the
.dtml files if you want to rename the variable.

Michel Pelletier wrote:
> 
> > -----Original Message-----
> > From: Ethan Fremen [mailto:mindlace@majordomo.net]
> > Sent: Friday, September 24, 1999 6:36 AM
> > To: Robert Leftwich
> > Cc: Zope Mailing List (E-mail)
> > Subject: Re: [Zope] Name of DTML file
> >
> >
> > Robert Leftwich wrote:
> > >
> > > Is there a way to find the filename of a DTML file that is used in a
> > > product via HTMLFile() ? I have tried various things, name(),
> > > _['__name__'], etc without success.
> >
> > If these are DTML Documents, then id() should give you the
> > filename. If
> > they are methods, I'm not sure what you should do.
> 
> An HTMLFile object does store it's filename because it re-reads the file
> when Zope is restarted (if Zope is in debug mode '-D' it rereads the
> file on every hit, this is very useful).
> 
> myHTMLFile.__name__ is the filename.
> 
> -Michel
> 
> >
> > --
> > ~mindlace
> >
> >
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://www.zope.org/mailman/listinfo/zope
> >
> > (To receive general Zope announcements, see:
> > http://www.zope.org/mailman/listinfo/zope-announce
> >
> > For developer-specific issues, zope-dev@zope.org -
> > http://www.zope.org/mailman/listinfo/zope-dev )
> >