Custom Query (121 matches)
Results (10 - 12 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #12 | fixed | PyYAML is slow | xi | edemaine@… |
| Description |
Here are two simple wall-clock timings comparing PyYAML to PySyck on a Pentium 4 2.8GHz with 1MB cache and 1GB RAM: $ wc file1.yaml 2036 8767 59154 file1 $ test.py file1.yaml 0:00:00.001419 to read the YAML via Syck 0:00:04.029627 to read the YAML via PyYAML $ wc file2.yaml 8949 35105 317342 file2 $ test.py file2.yaml 0:00:00.001564 to read the YAML via Syck 0:00:19.288912 to read the YAML via PyYAML I do not expect PyYAML to be terribly competitive with Syck: the language barrier is big, and PyYAML is written with a higher level of abstraction. But I was surprised to see a factor of 12,000 difference. I wonder if a bit of profiling and tuning might reduce this gap to just a couple of orders of magnitude (100x) instead of four? Personally, 19 seconds to read a 0.3 meg file is too slow for my application, so I'll have to switch back to Syck for now, unfortunately. Just food for thought... |
|||
| #13 | fixed | Windows install broken | xi | anonymous |
| Description |
None of the source files install except the EGG-INFO directory. C:\>easy_install -Z PyYAML Searching for PyYAML Reading http://www.python.org/pypi/PyYAML/ Reading http://pyyaml.org/wiki/PyYAML Best match: PyYAML 3.01 Downloading http://pyyaml.org/download/pyyaml/PyYAML-3.01.win32.exe Processing PyYAML-3.01.win32.exe WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/resolver.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/parser.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/scanner.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/error.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/composer.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/loader.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/events.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/dumper.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/tokens.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/serializer.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/constructor.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/representer.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/__init__.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/nodes.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/reader.py WARNING: can't process home/xi/lib/python2.4/site-packages/yaml/emitter.py creating 'c:\docume~1\user\locals~1\temp\easy_install-wfs0iv\PyYAML-3.01-py2.4-w in32.egg' and adding 'c:\docume~1\user\locals~1\temp\easy_install-wfs0iv\PyYAML- 3.01-py2.4-win32.egg.tmp' to it creating c:\python24\lib\site-packages\PyYAML-3.01-py2.4-win32.egg Extracting PyYAML-3.01-py2.4-win32.egg to c:\python24\lib\site-packages Adding PyYAML 3.01 to easy-install.pth file Installed c:\python24\lib\site-packages\pyyaml-3.01-py2.4-win32.egg Processing dependencies for PyYAML C:\> |
|||
| #14 | fixed | Inf and NaN handling needs re-vamp | xi | Scott David Daniels <Scott.Daniels@…> |
| Description |
Trying to import YAML fails in Python 2.5. Even simple patches fail, because the root cause is that NaNs and INFs cannot be marshalled/unmarshalled. Marshalling is used to save and restore compiled python modules, so a tested module can work initially, but later fail to load (when not from source). When handling INFs and NaNs, you need to be careful. 1e300000 is not a safe way to represent infinity, and fails to pickle/unpickle safely from manifest constants. Different C runtimes represent the text for INFs and NaNs differently. Since Python 2.5 folds constants, a simple expression won't solve the problem. The following changes should allow yaml to work on python 2.5a2 on Win2000 (and I think for 64-bit machines as well): =============== constructor.py: =============== *** 231,239 ****
else:
return sign*int(value)
- inf_value = 1e300000
- nan_value = inf_value/inf_value
-
def construct_yaml_float(self, node):
value = str(self.construct_scalar(node))
value = value.replace('_', '')
--- 231,236 ----
***************
***************
*** 242,251 ****
sign = -1
if value[0] in '+-':
value = value[1:]
! if value.lower() == '.inf':
! return sign*self.inf_value
! elif value.lower() == '.nan':
! return self.nan_value
elif ':' in value:
digits = [float(part) for part in value.split(':')]
digits.reverse()
--- 239,253 ----
sign = -1
if value[0] in '+-':
value = value[1:]
! if value.lower() in ('.inf', '.nan'):
! big = 1e300
! bigger = big * big
! while bigger > big and bigger == bigger:
! big = bigger
! bigger = big * big
! if value.lower() == '.nan':
! return bigger / bigger
! return sign * bigger
elif ':' in value:
digits = [float(part) for part in value.split(':')]
digits.reverse()
=============== representer.py: =============== *** 192,200 ****
def represent_long(self, data):
return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))
! repr_pos_inf = repr(1e300000)
! repr_neg_inf = repr(-1e300000)
! repr_nan = repr(1e300000/1e300000)
def represent_float(self, data):
repr_data = repr(data)
--- 192,206 ----
def represent_long(self, data):
return self.represent_scalar(u'tag:yaml.org,2002:int', unicode(data))
! big = 1e300
! bigger = big * big
! while bigger > big and bigger == bigger:
! big = bigger
! bigger = big * big
! repr_pos_inf = repr(bigger)
! repr_neg_inf = repr(-bigger)
! repr_nan = repr(bigger / bigger)
! del big, bigger
def represent_float(self, data):
repr_data = repr(data)
|
|||
