Hi!

I've updated the relation store's index in cpsskins to support wildcards
on triadic relations.

http://www.z3lab.org/sections/blogs/jean-marc-orliaguet/2005_08_27_triadic-relations

It gives extremely good scalability from 1 to 100000+ users (the script
used to measure query times is attached in the mail and in the 0.035 ms
a third of the time stands for function call overhead)

It seems that looking up an index key in a python dictionary is faster
than lookup up an the same key from an OOBTree, I haven't tried with
IOBTrees though.

regards
/JM
import time

from storage.relations import RelationStorage
from cpsskins.relations import TestRelate as Relate
from cpsskins.relations import Predicate, TriadicRelation

storage = RelationStorage()

precision = 10

def perf_1(n):
   predicate = Predicate('_ as portlet _ from perspective _ ')

   # create 100000 portlets in a same slot from 100000 different perspectives
   slot= Relate('main slot')

   for v in range(n):
      portlet = Relate('portlet %s' % str(v))
      perspective = Relate('perspective %s' % str(v))

      storage[str(v+n)] = TriadicRelation(predicate, slot, portlet, perspective)

   # get the list of portlets in the slot
   t1 = time.clock() # START

   for count in range(precision * 1000):
      a = storage.search(predicate=predicate, second=portlet)

   t2 = time.clock() # STOP
   print '%s, %s ms, %s' % (
       len(storage), str(round((t2-t1)/precision, 4)), len(storage._relates)
       )

if __name__ == '__main__':

    perf_1(1)
    perf_1(9)
    perf_1(90)
    perf_1(900)
    perf_1(9000)
    perf_1(90000)

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to