bug-bash
[Top][All Lists]
Advanced

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

Re: Magnitude of Order "For Loop" performance deltas based on syntax cha


From: isabella parakiss
Subject: Re: Magnitude of Order "For Loop" performance deltas based on syntax change
Date: Wed, 28 Sep 2016 03:36:38 +0200

On 9/26/16, Dan Douglas <ormaaj@gmail.com> wrote:
> Would an array of pointers to structs of key-value pairs be better
> here? It should be faster in the common cases even though it may mean
> some wasted space and reallocs depending on how you decide to grow the
> array. A linear search through an array for an index should be faster
> than linked-list traversal. https://youtu.be/YQs6IC-vgmo (why every
> std::vector implementation uses arrays, really it's true of analogues
> in most non-functional langs).
>
> Also bash itself makes it hard to use sparse arrays efficiently regardless
> of the implementation. In the case of lists, one usually wants to address
> elements by ordinal position, but both the index in `arr[index]` and the
> offset in `${arr[@]:offset:length}` don't allow it, which means random
> insertion requires a linear search despite being linked-lists. That also
> makes the "length" inconsistent with everything else that looks at the
> value of the index, though at least length does what I really wish
> offset did.
>

friendly reminder that trees exist


---
xoxo iza



reply via email to

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