[Zope-CMF] Accessing skins objects

Tres Seaver tseaver at palladion.com
Mon Feb 9 12:53:43 EST 2009

Hash: SHA1

Charlie Clark wrote:
> Am 09.02.2009 um 16:10 schrieb Tres Seaver:
>> Try profiling the two requests and see what looks different.
> I thought someone might say that... ;-)
> As heavy upstream caching is likely to be used I hope it's not  
> necessary to optimise this too much. The main advantage is reducing  
> the number of individual requests made by the browser when it first  
> sees the site. But I should get more familiar with profiling.
> Running locally wget gives rates of around about 50 MB/s with the view  
> and around 120 MB/s for a PythonScript.

This is talking directly to Zope (no Varnish / Squid in front?)  Please
post the PythonScript, too.

>> The FSFile
>> object *never* stores the bits read from the filesystem, so the more
>> likely case is that your view is hitting some other bottleneck.
> oh, what FS things are affected by the debug-mode flag that forces  
> them to be reread?, ie. which objects don't reflect underlying file- 
> system changes?

Other FS objects may have cached information computed from the file
(e.g., the compiled template bytecode for an FSPageTemplate, or bytecode
for an FSPythonScript).  But there is nothing which reads FSFile data
into memory and holds it.  both its '__str__' and its 'index_html'
reread the file from dist.  However, the object *may* be cached by a
RAMCache or an AcceleratedHTTPCache, if one is configured.

If Globals.DevelopmentMode is enabled, then the call to '_updateFromFS'
in both of those methods ('__str__', 'index_html') removes the object
from the cache on each request.

>> BTW, it might be faster to compute the *filenames* in the memo, and  
>> then
>> return an IFilestreamIterator which chunked the response by reading  
>> the
>> files one at a time.  Running 'cat /path/to/fsidr/*.js' in an
>> os.system() call might be faster, too ;)
> I quite like the iterator idea.

> BTW. Can I admit at this stage that I  
> don't really understand what the memoize method does? 8-)

It caches the result of the method call in the view's instance
dictionary.  Be *sure* to use it only for views:  using it on a content
objecct would be disastrous.

- --
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Zope-CMF mailing list