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

2016-09-27 Thread isabella parakiss
On 9/26/16, Dan Douglas 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

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

2016-09-26 Thread Dan Douglas
On Mon, Sep 26, 2016 at 3:32 PM, Chet Ramey wrote: > So you want offset N to be the nth element in the array instead of the > element with index N? Huh. Maybe, not always. Both would be nice. The offset isn't the element with the index N. It's the next set element whose

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

2016-09-26 Thread Chet Ramey
On 9/26/16 11:47 AM, Dan Douglas 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

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

2016-09-26 Thread Dan Douglas
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

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

2016-09-25 Thread Chet Ramey
On 9/24/16 8:29 AM, Christian Franke wrote: > - Method-2 could be significantly speed up if the order of the array > accesses is reversed: > > for (( i=0; i if (( -(Pi[i] - Pi[i+1]) < min )); then > min=$((-(Pi[i]-Pi[i+1]))) > fi > done > > Result: ~3

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

2016-09-25 Thread Chet Ramey
On 9/23/16 7:15 PM, Tom McCurdy wrote: > Bash Version: 4.3 > Patch Level: 11 > Release Status: release > > Description: > Two nearly identical "For Loop" setups have large deltas in > performance. See test program below. Was confirmed in IRC chat room by > multiple users. Input is very

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

2016-09-24 Thread Christian Franke
Tom McCurdy wrote: Bash Version: 4.3 Patch Level: 11 Release Status: release Description: Two nearly identical "For Loop" setups have large deltas in performance. See test program below. Was confirmed in IRC chat room by multiple users. Input is very noticeable with around 100,000