On 2007-11-16, Robin Becker <[EMAIL PROTECTED]> wrote:
> Neil Cerutti wrote:
> ...
>
>
> see why.
>>
>> You are no longer making m copies of active_nodes.
>
> my profiling indicated that the main problem was the removes.
Yeah, I should've added, "for one thing." I'm glad Chris
correctly poi
Neil Cerutti wrote:
...
see why.
>
> You are no longer making m copies of active_nodes.
my profiling indicated that the main problem was the removes.
>
>
> When you have to make many deletions from the middle of a
> sequence, you would normally choose a linked list. Python doe
Chris Mellon wrote:
>
> remove() does a linear search to find the item to remove, so it's O(n)
> + the actual deletion. Append() is amortized O(1) (overcommit). If you
> delete by index instead:
> for idx, node in active_nodes:
> if cond:
> del active_nodes[idx]
>
>
that's what I
On 2007-11-16, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> Instead, filter your list. It looks like you can't use filter
> directly, so just do it manually.
>
>for i in xrange(m):
>...
>saved_nodes = []
>for A in active_nodes[:]:
I meant to remove the slice. That line
On 2007-11-16, Robin Becker <[EMAIL PROTECTED]> wrote:
> I'm trying to get my head round a timing puzzle I find whilst
> optimizing A Kuchling's version of the Knuth line splitting
> algorithm from the oedipus project. The puzzle is as follows in
> highly abstract form
On Nov 16, 2007 12:42 PM, Robin Becker <[EMAIL PROTECTED]> wrote:
> I'm trying to get my head round a timing puzzle I find whilst optimizing A
> Kuchling's version of the Knuth line splitting algorithm from the oedipus
> project. The puzzle is as follows in h
I'm trying to get my head round a timing puzzle I find whilst optimizing A
Kuchling's version of the Knuth line splitting algorithm from the oedipus
project. The puzzle is as follows in highly abstract form (here
active_nodes is a list of objects kept in a sorted order, but th