[Checkins] SVN: lovely.viewcache/trunk/src/lovely/viewcache/ removed hits and misses, because it is too slow

Bernd Dorn bernd.dorn at lovelysystems.com
Mon Feb 19 05:52:04 EST 2007


Log message for revision 72668:
  removed hits and misses, because it is too slow

Changed:
  U   lovely.viewcache/trunk/src/lovely/viewcache/ftesting.zcml
  U   lovely.viewcache/trunk/src/lovely/viewcache/ram.py
  U   lovely.viewcache/trunk/src/lovely/viewcache/stats/README.txt
  U   lovely.viewcache/trunk/src/lovely/viewcache/stats/stats.pt
  U   lovely.viewcache/trunk/src/lovely/viewcache/zodb.py

-=-
Modified: lovely.viewcache/trunk/src/lovely/viewcache/ftesting.zcml
===================================================================
--- lovely.viewcache/trunk/src/lovely/viewcache/ftesting.zcml	2007-02-19 10:33:04 UTC (rev 72667)
+++ lovely.viewcache/trunk/src/lovely/viewcache/ftesting.zcml	2007-02-19 10:52:03 UTC (rev 72668)
@@ -3,12 +3,12 @@
            xmlns:meta="http://namespaces.zope.org/meta"
            i18n_domain="zope">
 
-  <include package="zope.app.zcmlfiles" />
+  <include package="zope.app" />
   <include package="zope.app.cache" />
   <include package="lovely.viewcache" />
  
  
-dependencies for viewlets and managers
+
   <include package="zope.contentprovider" />
   <include package="zope.viewlet" />
   <include package="zope.viewlet" file="meta.zcml" />

Modified: lovely.viewcache/trunk/src/lovely/viewcache/ram.py
===================================================================
--- lovely.viewcache/trunk/src/lovely/viewcache/ram.py	2007-02-19 10:33:04 UTC (rev 72667)
+++ lovely.viewcache/trunk/src/lovely/viewcache/ram.py	2007-02-19 10:52:03 UTC (rev 72668)
@@ -122,7 +122,6 @@
         try:
             if key is None:
                 del self._data[ob]
-                self._misses[ob] = 0
             else:
                 del self._data[ob][key]
                 if not self._data[ob]:
@@ -175,13 +174,10 @@
                     if str(ob) in cacheentry[0]:
                         #dependency cache entries have a list of dependen objects in val[0]
                         deps.append(dep)
-            hits = sum(entry[2] for entry in self._data[ob].itervalues())
             result.append({'path': ob,
                            'key': None,
-                           'misses': self._misses.get(ob, 0),
                            'size': totalsize,
                            'entries': len(self._data[ob]),
-                           'hits': hits,
                            'minage': minage,
                            'maxage': maxage,
                            'deps': deps,
@@ -192,10 +188,8 @@
                 if key is not None:
                     pathObj['keys'].append({'path': ob,
                                    'key': key,
-                                   'misses': '',
                                    'size': len(dumps(value)),
                                    'entries': '',
-                                   'hits': value[2],
                                    'minage': '',
                                    'maxage': '',
                                    'deps': None,

Modified: lovely.viewcache/trunk/src/lovely/viewcache/stats/README.txt
===================================================================
--- lovely.viewcache/trunk/src/lovely/viewcache/stats/README.txt	2007-02-19 10:33:04 UTC (rev 72667)
+++ lovely.viewcache/trunk/src/lovely/viewcache/stats/README.txt	2007-02-19 10:52:03 UTC (rev 72668)
@@ -79,10 +79,10 @@
    
    
 
-The first row of a new view does not stand for a cache entry but for all cache entries of the respective view.
-It summarizes the sizes, hits and misses, shows the number of cache-entries and the lifetime settings.
+The first row of a new view does not stand for a cache entry but for
+all cache entries of the respective view.  It summarizes the sizes and
+shows the number of cache-entries and the lifetime settings.
 
-
 You can invalidate all cache entries for a view by invalidating this first row.
 
   >>> controls.controls[0].selected = True
@@ -100,4 +100,4 @@
    ...
 
    
-XXX show/test invalidateAll
\ No newline at end of file
+XXX show/test invalidateAll

Modified: lovely.viewcache/trunk/src/lovely/viewcache/stats/stats.pt
===================================================================
--- lovely.viewcache/trunk/src/lovely/viewcache/stats/stats.pt	2007-02-19 10:33:04 UTC (rev 72667)
+++ lovely.viewcache/trunk/src/lovely/viewcache/stats/stats.pt	2007-02-19 10:52:03 UTC (rev 72668)
@@ -25,8 +25,6 @@
 	    	<tr>
 		      <th i18n:translate="">Invalidate</th>
 		      <th i18n:translate="" colspan="2">Path</th>
-		      <th i18n:translate="">Hits</th>
-		      <th i18n:translate="">Misses</th>
 		      <th i18n:translate="">Size, bytes</th>
 		      <th i18n:translate="">Entries</th>
 		      <th i18n:translate="">Minage</th>
@@ -46,8 +44,6 @@
           <td colspan="2">
             <span tal:condition="not: data/key" tal:replace="data/path">/url/manager/view</span>
           </td>
-	        <td tal:content="data/hits">1</td>
-	        <td tal:content="data/misses">0</td>
 	        <td tal:content="data/size">1.7</td>
 	        <td tal:content="data/entries">2</td>
 	        <td tal:content="data/minage">1000</td>
@@ -69,8 +65,6 @@
 	        </td>
           <td width="20px"></td>
 	        <td><span tal:replace="item/key">/url/manager/view</span></td>
-	        <td tal:content="item/hits">1</td>
-	        <td tal:content="item/misses">0</td>
 	        <td tal:content="item/size">1.7</td>
 	        <td tal:content="item/entries">2</td>
 	        <td tal:content="item/minage">1000</td>

Modified: lovely.viewcache/trunk/src/lovely/viewcache/zodb.py
===================================================================
--- lovely.viewcache/trunk/src/lovely/viewcache/zodb.py	2007-02-19 10:33:04 UTC (rev 72667)
+++ lovely.viewcache/trunk/src/lovely/viewcache/zodb.py	2007-02-19 10:52:03 UTC (rev 72668)
@@ -96,9 +96,6 @@
         try:
             data = self._data[ob][key]
         except KeyError:
-            if ob not in self._misses:
-                self._misses[ob] = Length()
-            self._misses[ob].change(1)
             raise
         else:
             #NOTE: hit count is deactivated because of too many database writes
@@ -126,7 +123,6 @@
         try:
             if key is None:
                 del self._data[ob]
-                self._misses[ob] = Length()
             else:
                 del self._data[ob][key]
                 if not self._data[ob]:
@@ -138,7 +134,6 @@
         """Drop all the cached values.
         """
         self._data = OOBTree()
-        self._misses = OOBTree()
 
     def removeStaleEntries(self):
         "Remove the entries older than `maxAge`"
@@ -198,8 +193,6 @@
         for dict in self._data.itervalues():
             for val in dict.itervalues():
                 val[2].set(0)
-        for k in self._misses.values():
-            k.set(0)
 
     def getKeys(self, object):
         return self._data[object].keys()
@@ -212,14 +205,7 @@
 
         for ob in objects:
             size = len(dumps(self._data[ob]))
-            hits = sum(entry[2]() for entry in self._data[ob].itervalues())
-            if ob in self._misses:
-                misses = self._misses[ob]()
-            else:
-                misses = 0
             result.append({'path': ob,
-                           'hits': hits,
-                           'misses': misses,
                            'size': size,
                            'entries': len(self._data[ob])})
         return tuple(result)
@@ -239,17 +225,10 @@
                     if str(ob) in cacheentry[0]:
                         #dependency cache entries have a list of dependen objects in val[0]
                         deps.append(dep)
-            hits = sum(entry[2]() for entry in self._data[ob].itervalues())
-            if ob in self._misses:
-                misses = self._misses[ob]()
-            else:
-                misses = 0
             result.append({'path': ob,
                            'key': None,
-                           'misses': misses,
                            'size': totalsize,
                            'entries': len(self._data[ob]),
-                           'hits': hits,
                            'minage': minage,
                            'maxage': maxage,
                            'deps': deps,
@@ -260,10 +239,8 @@
                 if key is not None:
                     pathObj['keys'].append({'path': ob,
                                    'key': key,
-                                   'misses': '',
                                    'size': len(dumps(value)),
                                    'entries': '',
-                                   'hits': value[2](),
                                    'minage': '',
                                    'maxage': '',
                                    'deps': None,



More information about the Checkins mailing list