On Mon, Mar 23, 2015 at 10:17:11PM -0400, Dave Angel wrote:
> On 03/23/2015 09:42 PM, boB Stepp wrote:
> >Can you give me a ballpark number for "large", where this would start
> >making a meaningful difference?
> >
>
> Not really. See Steve's response for some numbers.
o_O
Have you borrowed Gu
On 03/23/2015 10:17 PM, Dave Angel wrote:
On 03/23/2015 09:42 PM, boB Stepp wrote:
Not really. See Steve's
OOPS. Peter's
> response for some numbers. If I had to guess,
I'd say that for lists over 100 items, you should use bisect or
equivalent. But I'd also say you should have one algo
On Mon, Mar 23, 2015 at 08:42:23PM -0500, boB Stepp wrote:
> On Thu, Mar 19, 2015 at 12:10 AM, Dave Angel wrote:
> > The catch to a list comprehension is it has to visit all the elements, while
> > a binary search would visit log-base-2 of them. So instead of 1
> > elements, you'd be searchin
On 03/23/2015 09:42 PM, boB Stepp wrote:
On Thu, Mar 19, 2015 at 12:10 AM, Dave Angel wrote:
The catch to a list comprehension is it has to visit all the elements, while
a binary search would visit log-base-2 of them. So instead of 1
elements, you'd be searching about 14 items.
I suspect
On Thu, Mar 19, 2015 at 4:52 AM, Peter Otten <__pete...@web.de> wrote:
> Dave Angel wrote:
[...]
> By the way, if you were to use a plain old loop the expected speedup over
> the listcomp would be 2. You can break out of the loop when you have found
> the gap, after iterating over one half of the
On Thu, Mar 19, 2015 at 12:10 AM, Dave Angel wrote:
> The catch to a list comprehension is it has to visit all the elements, while
> a binary search would visit log-base-2 of them. So instead of 1
> elements, you'd be searching about 14 items.
I suspected as much, but had not verified this.