2**HUGENUMBER Why not optimise it?

Christian Tismer tismer at tismer.com
Thu May 23 04:41:23 EDT 2002


Mike C. Fletcher wrote:
> Oh. Sigh.

Cheer up!

> Maybe I'll just give up on trying to interest people in Python 
> optimisation challenges.  The good-old days of idle speculation and 
> optimisation are dead.  Time to stop living in the past.  Idea dropped, 
> back to boring GUI work.

Don't say such sad words.
Nothing is dead but maybe some of our expectations.
Python was never eager to adopt new features (which
is good), but putting ideas down this short wasn't
usual, too.

I hereby encourage you to write that in the best
way you can, since I know of a Python branch
that will happily adopt any short and sensible optimization.
I can contribute a bunch to this, too.

> Tim Peters wrote:
> 
>> [Mike C. Fletcher]
> 
> ...
> 
>> Why bother?  i**j is performed by a general algorithm that does a 
>> number of
>> long-int multiplications, but no more than 2*ceiling(log_base_2(j)) of 
>> them.
>> i==1 is not a special case; it zooms simply because all of the O(log(j))
>> intermediate products are exactly 1, so go very quickly.
> 
> ...
> 
>> No, there's simply no point to burning code space to special-case 
>> power-of-2
>> bases; if you know your base is a power of 2, feel free to shift 
>> yourself --
>> I do <wink>.

Viruses pretending to be real emails are becoming
a problem. This one was just simple to detect:
The real Timbot would either implement it in less
bytes than the text of this response, or propose
to provide an appropriate optional extension mechanism
for special optimization modules.

dissing-neat-stuff-is-another-wise-mans-job<snort>-ly y'rs  - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/







More information about the Python-list mailing list