Re: Zip vs Enumerate

2018-06-20 Thread Jordan Wilson via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 05:49:15 UTC, Dukc wrote: On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: Is there anything I can do to improve zip, before I go ahead and change to the faster but slightly less readable enumerate? The problem might be that zip checks both arrays

Re: Zip vs Enumerate

2018-06-19 Thread Dukc via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: Is there anything I can do to improve zip, before I go ahead and change to the faster but slightly less readable enumerate? The problem might be that zip checks both arrays for empty during each step, enumerate only the first

Re: Zip vs Enumerate

2018-06-19 Thread Cym13 via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 04:40:42 UTC, Cym13 wrote: On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: [...] This sounds like a very limited case: if you're not zipping against a iota(foo) then there's no comparing with enumerate, they simply don't do the same thing at

Re: Zip vs Enumerate

2018-06-19 Thread Cym13 via Digitalmars-d-learn
On Wednesday, 20 June 2018 at 03:44:58 UTC, Jordan Wilson wrote: Hello, Idiomatically, I make use of zip, however, when looking to speed up my program, notice that using enumerate leads to a 20-30% improvement: void main(){ auto x = iota(1_000).array; auto y = iota(1_000).array;

Zip vs Enumerate

2018-06-19 Thread Jordan Wilson via Digitalmars-d-learn
Hello, Idiomatically, I make use of zip, however, when looking to speed up my program, notice that using enumerate leads to a 20-30% improvement: void main(){ auto x = iota(1_000).array; auto y = iota(1_000).array; auto func1() { return zip(x,y).map!(a => a[0]+a[1])