Author: Laurence Tratt <lau...@tratt.net>
Branch: 
Changeset: r298:2a17a0177782
Date: 2014-12-11 14:50 +0000
http://bitbucket.org/pypy/benchmarks/changeset/2a17a0177782/

Log:    Don't read/write from a cache file.

        Without this, the benchmark's behaviour is (even more) non-
        deterministic from one run to another.

diff --git a/own/krakatau/Krakatau/Krakatau/stdcache.py 
b/own/krakatau/Krakatau/Krakatau/stdcache.py
--- a/own/krakatau/Krakatau/Krakatau/stdcache.py
+++ b/own/krakatau/Krakatau/Krakatau/stdcache.py
@@ -6,11 +6,14 @@
         self.env = env
         self.filename = filename
 
-        try:
-            with open(self.filename, 'rb') as f:
-                fdata = f.read()
-        except IOError:
-            fdata = ''
+        # XXX for a benchmark, we don't ever want to use a cache, so we simply
+        # don't load data from a cache file (even if it exists)
+        fdata = ''
+        #try:
+        #    with open(self.filename, 'rb') as f:
+        #        fdata = f.read()
+        #except IOError:
+        #    fdata = ''
 
         #Note, we assume \n will never appear in a class name. This should be 
true for classes in the Java package,
         #but isn't necessarily true for user defined classes (Which we don't 
cache anyway)
@@ -24,8 +27,8 @@
         newvals = class_.getSuperclassHierarchy(), class_.flags 
         self.data[class_.name] = newvals 
         writedata = ';'.join(','.join(x) for x in newvals)
-        with open(self.filename, 'ab') as f:
-            f.write(writedata + '\n')
+        #with open(self.filename, 'ab') as f:
+        #    f.write(writedata + '\n')
         print class_.name, 'cached'
 
     def isCached(self, name): return name in self.data
@@ -46,4 +49,4 @@
         class_ = self.env.getClass(name, partial=True)
         if shouldCache(name):
             self._cache_info(class_)
-        return class_.flags
\ No newline at end of file
+        return class_.flags
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to