[pypy-svn] r17042 - pypy/dist/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Mon Aug 29 17:30:12 CEST 2005


Author: arigo
Date: Mon Aug 29 17:30:11 2005
New Revision: 17042

Modified:
   pypy/dist/pypy/tool/tls.py
Log:
Oups.  Major performance hit on top of 2.3...


Modified: pypy/dist/pypy/tool/tls.py
==============================================================================
--- pypy/dist/pypy/tool/tls.py	(original)
+++ pypy/dist/pypy/tool/tls.py	Mon Aug 29 17:30:11 2005
@@ -1,16 +1,25 @@
-"""Thread-local storage."""
+##"""Thread-local storage."""
+##
+##try:
+##    from thread import _local as tlsobject
+##except ImportError:   # Python < 2.4
+##
+##    # XXX needs a real object whose attributes are visible only in
+##    #     the thread that reads/writes them.
+##
+##    import autopath, os
+##    filename = os.path.join(os.path.dirname(autopath.pypydir),
+##                            'lib-python', '2.4.1', '_threading_local.py')
+##    glob = {'__name__': '_threading_local'}
+##    execfile(filename, glob)
+##    tlsobject = glob['local']
+##    del glob, filename
 
-try:
-    from thread import _local as tlsobject
-except ImportError:   # Python < 2.4
 
-    # XXX needs a real object whose attributes are visible only in
-    #     the thread that reads/writes them.
 
-    import autopath, os
-    filename = os.path.join(os.path.dirname(autopath.pypydir),
-                            'lib-python', '2.4.1', '_threading_local.py')
-    glob = {'__name__': '_threading_local'}
-    execfile(filename, glob)
-    tlsobject = glob['local']
-    del glob, filename
+
+class tlsobject(object):
+    """Storage that is NOT THREAD-LOCAL AT ALL because we don't really need it
+    at the moment, and it has a performance impact -- a minor one on top of 2.4,
+    and an extreme one on top of 2.3 :-(((((
+    """



More information about the Pypy-commit mailing list