This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ajaksu2
Recipients ajaksu2, facundobatista, mark.dickinson
Date 2007-09-12.22:28:26
SpamBayes Score 0.02805407
Marked as misclassified No
Message-id <1189636107.49.0.575570026381.issue1772851@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2007-09-12 22:28:27ajaksu2setspambayes_score: 0.0280541 -> 0.02805407
recipients: + ajaksu2, facundobatista, mark.dickinson
2007-09-12 22:28:27ajaksu2setspambayes_score: 0.0280541 -> 0.0280541
messageid: <1189636107.49.0.575570026381.issue1772851@psf.upfronthosting.co.za>
2007-09-12 22:28:27ajaksu2linkissue1772851 messages
2007-09-12 22:28:26ajaksu2create