ajaksu added the comment: Thanks a lot for the explanation. I still think it could be valuable (C?)py3k change (but now for the predictability, as you say :)
Regarding the performance of Decimal.__hash__: I believe (int) hash performance would be a moot issue if Decimal.__int__ was (much) faster. I've been, for the last three days, trying to convert decimal.py to use longs instead of tuples for Decimal._int. Here are some (hand picked) results (on a Celeron M 1.46GHz): In [906]: D = int_decimal.Decimal (...) In [914]: g = D("1E1000000") (...) In [916]: g Out[916]: Decimal("1E+1000000") (...) In [918]: %timeit k = int(g) 10 loops, best of 3: 3.22 s per loop (...) In [920]: %timeit k = hash(int(g)) 10 loops, best of 3: 3.28 s per loop (...) In [922]: log(int(g)) Out[922]: 2302585.0929940455 In [923]: log(10**1000000) Out[923]: 2302585.0929940455 I'm not very competent in many skills needed for the job AND I'm working between field trips (next starts tomorrow), so, unfortunately, the results are crude and awfully buggy so far. Most "(...)" above were exceptions for simple things like "hash(g)" and there are lots of these issues. The conversion is based on using divisions and multiplications to truncate/extend Decimal._int, from the notion that the bottleneck is the tuple->str->int conversion. I predict lots of currently fast things getting slower and a higher memory footprint, but it might still be worth it and I'm willing to test the idea. As I told Facundo in a private email (y otro llegará hoy o mañana), the simple cases seem workable for me, but I'm not able to tell right now if this has any real chances of succeeding (because I'm bad at maths :/). I've not even looked at __pow__, __mul__ and __div__ yet! Anyway, I'll try to tidy things up as much as I can and email Facundo (and yourself, if you are interested) the results of this large ugly hack before now + 24h. _____________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1772851> _____________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com