coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: numfmt enhancements to emulate df -g


From: Pádraig Brady
Subject: Re: numfmt enhancements to emulate df -g
Date: Sat, 20 Jun 2015 11:51:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 20/06/15 03:57, Dylan Cali wrote:
> On Fri, Jun 19, 2015 at 3:08 PM, Pádraig Brady <address@hidden> wrote:
>> Dylan I used/adjusted your patch for multiple fields support.
> 
> Thanks Pádraig, excited to see this making its way into the mainline.
> 
>> Note I moved from an avltree to a linked list so that memory
>> consumption was proportional to the number of field specifications,
>> rather than the number of fields specified.
> 
> Can't you store field specifications as the elements in an avl tree as
> well, without having to resort to something fancy like an interval
> tree?  And if it's the same number of elements, shouldn't memory
> consumption be the same as with a linked list since they're both node
> based structures?

With most and all standard range specs this would work,
though for certain overlapping range specs, the short circuiting
involved in the tree search could skip matching pairs.

> I went with the avl tree just because theoretically if someone were to
> list duplicate, out of order fields (or field specs) inserting them is
> going to be O(n) with a sorted linked list vs O(logn) with a binary
> search tree.  Obviously for such a small cli tool it doesn't really
> matter though.

Right, the vast majority of cases is very few specified pairs.
Again focusing on performance would take advantage of the
linear scan being done, like cut does.

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]