Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87013 > unrolled thread

Re: Speeding up permutations generation

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2015-03-06 10:33 +0000
Last post2015-03-06 10:33 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Speeding up permutations generation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-06 10:33 +0000

#87013 — Re: Speeding up permutations generation

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-03-06 10:33 +0000
SubjectRe: Speeding up permutations generation
Message-ID<mailman.104.1425637998.21433.python-list@python.org>
On 06/03/2015 09:59, Chris Angelico wrote:
> On Fri, Mar 6, 2015 at 7:24 PM, Abhiram R <abhi.darkness@gmail.com> wrote:
>>> A list of 100 elements has approximately 9.33 x 10**157 permutations.
>>> If you could somehow generate one permutation every yoctosecond,
>>> exhausting them would still take more than a hundred orders of
>>> magnitude longer than the age of the universe.
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>
>>
>> True that :D I may have exaggerated on the number. Let's consider something
>> more practically manageable => 50 elements with a 50! permutation.
>> Is there a solution now?
>>
>
> Is the actual generation of permutations your problem? You mentioned
> that you're using itertools, so I would expect that you're simply
> iterating over that; I hope you're not immediately trying to construct
> a list of them all, because that would cost the memory that Mark's
> response talks about. Have you actually profiled your code and found
> that generating permutations is the bottleneck, or did you just guess?
> Because even experienced programmers - even extremely experienced
> Python programmers - are usually wrong when they guess about the
> slowest part of a program. The only way to know is to measure.
>
> ChrisA
>

s/Mark/Wolfgang/ ?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web