Re: [Zope] speeding up dtml-tree<00b001c006da$d19c4310$6703a8c0@torch>

2000-08-26 Thread Dieter Maurer

Clinton Roy writes:
 >  external method restrictions 
 > I'm losing faith people..

Maybe, you should not.

There are more ways to build extensions than external methods
in "Extension" directories.

Each way has its advantages and drawbacks:

TypeWeb Manageable  requires restart

DTML Methods yesno

ZClasses yesno

External methodspartly  no

Productspartly  yes

Python Modules   no yes



The restrictions for source files in the Extension directories
are documented together with a description what to do
to circumvent the restrictions:

   These source files are not imported as standard Python
   modules but they are read in and executed.

   As a consequence, Zope may simply reread and
   reexecute them when they changed. A restart
   is not necessary.
   If they could be used like full Python modules,
   then it would be very difficult to do this
   in a safe manner unless the Python import
   and lookup mechanisms are changed.
   This might be possible but difficult.

   On the downside, instances of classes defined in these
   source files can not be pickled (and therefore stored
   in the ZODB). The pickle mechanism does not
   understand Zope's read and execute but
   requires standard Python module import.

   The workaround: define the classes (!) you need
   for ZODB objects in true Python modules.
   The documentation suggests to define them
   in a properly named subpackage of "Shared" such that
   maintenance will not become a nightmare.
   Yes, changes to true Python modules (and therefore
   to your classes) require a Zope restart.
   But, hopefully, you will not change your classes
   too often.

   You can instantiate your classes, i.e. build
   instances from them, in external methods,
   i.e. in source files located in an Extension
   folder.

   There is no need to have the same code at two
   places! Classes for picklable objects or
   infrastructure to be used in several source
   files in true Python modules,
   everything else (if you want) in external methods.


Each tool has its strengthes and weaknesses. Know them
and use the right tool for your task.
This applies both to (sub-)tools inside Zope
(e.g. external method versus product versus Python module)
as well as to Zope itself (versus ASP, PHP, JSP, ...).


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] speeding up dtml-tree

2000-08-24 Thread Clinton Roy



"Andy McKay" <[EMAIL PROTECTED]> writes:

> A real crude way to hack the dtml-tree tag is to make it always assume there
> are child nodes. This prevents the look up and is a lot faster. Think of
> Windows Explorer style tag.
Not really something I want to do, and in my case wouldn't really help
anyway, as the icon chosen quite often depends on children values.

Dieter Maurer <[EMAIL PROTECTED]> writes:
> You could implement your own cache in your external methods.

All I ended up doing was pickling the data structures that I created
and doing some simple caching. It works beautifully. Not that Zope
helped me at all. I couldn't import modules from the Extensions
directory, so I ended up having to put things in $ZOPE/lib/python. For
testing I had to have things in the Extensions directory; two copies
of things flying around isn't nice. When unpickling under Zope, python
couldn't find the class I was referring to, so I ended up just caching
the initargs.

While none of the above hoop jumping was hard, it was a pain. I
certainly hope extensions are supported better in 2.2, in particular:

* being able to import modules from the extensions directory
* not having naming problems when using extensions under zope

I'm about >< close to ditching a Zope talk I was preparing to give to my
local Unix users group, but I'm going to see if 2.2 has improved.

I'm losing faith people..
-- 
Clinton Roy

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] speeding up dtml-tree

2000-08-15 Thread Dieter Maurer

Clinton Roy writes:
 > i'm using the dtml-tree tag and generating it's contents via external
 > methods. Unfortunately child lookups are quite slow, as well as the
 > icon choosing machinery; is there any way to cache the tree node
 > objects that my external method creates?
The tree tag itself does not cache.

You could implement your own cache in your external methods.

We extended the tree tag with a "has_branches" argument.
If present, it should be a method that tells for the
current object whether it has branches (aka children).
This reduced the number of database accesses (where
our tree data really lives) by an order of magnitude.


In principle, I could give you (or the community) a
patch for "has_branches". Unfortunately, we extended
the tree tag quite drastically (configurable icons, "has_branches",
"input type=image" instead of "a href" tags for tree operations).
Thus, the "has_branches" extension comes embedded in a big
patch that may not be easy to understand.



Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] speeding up dtml-tree

2000-08-15 Thread Andy McKay

A real crude way to hack the dtml-tree tag is to make it always assume there
are child nodes. This prevents the look up and is a lot faster. Think of
Windows Explorer style tag.

--
 Andy McKay, Developer, ActiveState
 http://www.ActiveState.com
 Programming for the People


- Original Message -
From: "Clinton Roy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 14, 2000 9:06 PM
Subject: [Zope] speeding up dtml-tree


> hello folks
>
> i'm using the dtml-tree tag and generating it's contents via external
> methods. Unfortunately child lookups are quite slow, as well as the
> icon choosing machinery; is there any way to cache the tree node
> objects that my external method creates?
>
> thanks for any help.
> --
> Clinton Roy
>
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] speeding up dtml-tree

2000-08-14 Thread Clinton Roy

hello folks

i'm using the dtml-tree tag and generating it's contents via external
methods. Unfortunately child lookups are quite slow, as well as the
icon choosing machinery; is there any way to cache the tree node
objects that my external method creates?

thanks for any help.
-- 
Clinton Roy


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )