[pypy-commit] pypy default: kill remnants of the long dead MeasuringDictImplementation
pjenvey
noreply at buildbot.pypy.org
Sat Apr 12 02:12:23 CEST 2014
Author: Philip Jenvey <pjenvey at underboss.org>
Branch:
Changeset: r70596:d821161dcac8
Date: 2014-04-11 17:05 -0700
http://bitbucket.org/pypy/pypy/changeset/d821161dcac8/
Log: kill remnants of the long dead MeasuringDictImplementation
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -1277,7 +1277,6 @@
class TestBytesDictImplementation(BaseTestRDictImplementation):
StrategyClass = BytesDictStrategy
- #ImplementionClass = BytesDictImplementation
def test_str_shortcut(self):
self.fill_impl()
@@ -1289,9 +1288,6 @@
self.fill_impl()
assert self.fakespace.view_as_kwargs(self.impl) == (["fish", "fish2"], [1000, 2000])
-## class TestMeasuringDictImplementation(BaseTestRDictImplementation):
-## ImplementionClass = MeasuringDictImplementation
-## DevolvedClass = MeasuringDictImplementation
class BaseTestDevolvedDictImplementation(BaseTestRDictImplementation):
def fill_impl(self):
diff --git a/pypy/tool/readdictinfo.py b/pypy/tool/readdictinfo.py
deleted file mode 100644
--- a/pypy/tool/readdictinfo.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# this is for use with a pypy-c build with multidicts and using the
-# MeasuringDictImplementation -- it will create a file called
-# 'dictinfo.txt' in the local directory and this file will turn the
-# contents back into DictInfo objects.
-
-# run with python -i !
-
-import sys
-
-if __name__ == '__main__':
- infile = open(sys.argv[1])
-
- curr = None
- slots = []
- for line in infile:
- if line == '------------------\n':
- if curr:
- break
- curr = 1
- else:
- attr, val = [s.strip() for s in line.split(':')]
- slots.append(attr)
-
- class DictInfo(object):
- __slots__ = slots
-
- infile = open(sys.argv[1])
-
- infos = []
-
- for line in infile:
- if line == '------------------\n':
- curr = object.__new__(DictInfo)
- infos.append(curr)
- else:
- attr, val = [s.strip() for s in line.split(':')]
- if '.' in val:
- val = float(val)
- else:
- val = int(val)
- setattr(curr, attr, val)
-
-def histogram(infos, keyattr, *attrs):
- r = {}
- for info in infos:
- v = getattr(info, keyattr)
- l = r.setdefault(v, [0, {}])
- l[0] += 1
- for a in attrs:
- d2 = l[1].setdefault(a, {})
- v2 = getattr(info, a)
- d2[v2] = d2.get(v2, 0) + 1
- return sorted(r.items())
-
-def reportDictInfos():
- d = {}
- stillAlive = 0
- totLifetime = 0.0
- for info in infos:
- for attr in slots:
- if attr == 'maxcontents':
- continue
- v = getattr(info, attr)
- if not isinstance(v, int):
- continue
- d[attr] = d.get(attr, 0) + v
- if info.lifetime != -1.0:
- totLifetime += info.lifetime
- else:
- stillAlive += 1
- print 'read info on', len(infos), 'dictionaries'
- if stillAlive != len(infos):
- print 'average lifetime', totLifetime/(len(infos) - stillAlive),
- print '('+str(stillAlive), 'still alive at exit)'
- print d
-
-def Rify(fname, *attributes):
- output = open(fname, 'w')
- for attr in attributes:
- print >>output, attr,
- print >>output
- for info in infos:
- for attr in attributes:
- print >>output, getattr(info, attr),
- print >>output
-
-if __name__ == '__main__':
-# reportDictInfos()
-
- # interactive stuff:
-
- import __builtin__
-
- def displayhook(v):
- if v is not None:
- __builtin__._ = v
- pprint.pprint(v)
- sys.displayhook = displayhook
-
- import pprint
- try:
- import readline
- except ImportError:
- pass
- else:
- import rlcompleter
- readline.parse_and_bind('tab: complete')
-
- if len(sys.argv) > 2:
- attrs = sys.argv[2].split(',')
- if attrs == ['all']:
- attrs = slots
- Rify("R.txt", *attrs)
-
-
diff --git a/pypy/tool/rundictbenchmarks.py b/pypy/tool/rundictbenchmarks.py
deleted file mode 100644
--- a/pypy/tool/rundictbenchmarks.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import sys, os
-
-# this file runs some benchmarks with a pypy-c that is assumed to be
-# built using the MeasuringDictImplementation.
-
-# it should be run with pypy/goal as the cwd, and you'll
-# need to hack a copy of rst2html for yourself (svn docutils
-# required).
-
-if __name__ == '__main__':
- try:
- os.unlink("dictinfo.txt")
- except os.error:
- pass
-
- progs = [('pystone', ['-c', 'from test import pystone; pystone.main()']),
- ('richards', ['richards.py']),
- ('docutils', ['rst2html.py', '../../doc/coding-guide.txt', 'foo.html']),
- ('translate', ['translate.py', '--backendopt', '--no-compile', '--batch',
- 'targetrpystonedalone.py'])
- ]
-
- EXE = sys.argv[1]
-
- for suffix, args in progs:
- os.spawnv(os.P_WAIT, EXE, [EXE] + args)
- os.rename('dictinfo.txt', 'dictinfo-%s.txt'%suffix)
More information about the pypy-commit
mailing list