[pypy-svn] r59062 - pypy/dist/pypy/translator/goal

iko at codespeak.net iko at codespeak.net
Mon Oct 13 10:46:45 CEST 2008


Author: iko
Date: Mon Oct 13 10:46:45 2008
New Revision: 59062

Added:
   pypy/dist/pypy/translator/goal/targettestdicts.py   (contents, props changed)
   pypy/dist/pypy/translator/goal/targettestlistvsdict.py   (contents, props changed)
Log:
(iko,pedronis)
Some test food for static data info. These generate insane results:

for targettestdicts.py, only the size of the dicts are counted, not
the contained strings (so the result is too small).

for targettestlistvsdict.py, the list only seems to count the size
of the contained strings, not the size of the array. The dict is
counted (correctly? since the same strings are in the list) as the
size of its structure. 



Added: pypy/dist/pypy/translator/goal/targettestdicts.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/goal/targettestdicts.py	Mon Oct 13 10:46:45 2008
@@ -0,0 +1,30 @@
+"""
+A simple standalone target.
+
+The target below specifies None as the argument types list.
+This is a case treated specially in driver.py . If the list
+of input types is empty, it is meant to be a list of strings,
+actually implementing argv of the executable.
+"""
+
+import os, sys
+
+def debug(msg): 
+    os.write(2, "debug: " + msg + '\n')
+
+# __________  Entry point  __________
+
+test_dict = dict(map(lambda x: (x, hex(x)), range(5000)))
+reverse_dict = dict(map(lambda (x,y): (y,x), test_dict.items()))
+
+def entry_point(argv):
+    if argv[1] == 'd':
+        print test_dict[int(argv[2])]
+    else:
+        print reverse_dict[argv[2]]
+    return 0
+
+# _____ Define and setup target ___
+
+def target(*args):
+    return entry_point, None

Added: pypy/dist/pypy/translator/goal/targettestlistvsdict.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/goal/targettestlistvsdict.py	Mon Oct 13 10:46:45 2008
@@ -0,0 +1,30 @@
+"""
+A simple standalone target.
+
+The target below specifies None as the argument types list.
+This is a case treated specially in driver.py . If the list
+of input types is empty, it is meant to be a list of strings,
+actually implementing argv of the executable.
+"""
+
+import os, sys
+
+def debug(msg): 
+    os.write(2, "debug: " + msg + '\n')
+
+# __________  Entry point  __________
+
+test_list = map(hex, range(5000))
+test_dict = dict(map(lambda x: (x, hex(x)), range(5000)))
+
+def entry_point(argv):
+    if argv[1] == 'd':
+        print test_dict[int(argv[2])]
+    else:
+        print test_list[int(argv[2])]
+    return 0
+
+# _____ Define and setup target ___
+
+def target(*args):
+    return entry_point, None



More information about the Pypy-commit mailing list