Re: foreach - premature optimization vs cultivating good habits

2015-02-01 Thread Laeeth Isharc via Digitalmars-d-learn
Thank you Adam, Bbaz and Ola for the helpful thoughts. I dumped them in a wiki page off the sandbox but needs editing and refining.

Re: foreach - premature optimization vs cultivating good habits

2015-01-31 Thread via Digitalmars-d-learn
On Friday, 30 January 2015 at 14:41:11 UTC, Laeeth Isharc wrote: Thanks, Adam. That's what I had thought (your first paragraph), but something Ola on a different thread confused me and made me think I didn't understand it, and I wanted to pin it down. There is always significant

Re: foreach - premature optimization vs cultivating good habits

2015-01-30 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 30 January 2015 at 12:55:20 UTC, Adam D. Ruppe wrote: On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote: As I understand it, foreach allocates when a simple C-style for using an array index would not. foreach is just syntax sugar over a for loop. If there's any

Re: foreach - premature optimization vs cultivating good habits

2015-01-30 Thread John Colvin via Digitalmars-d-learn
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote: Hi. The standard advice is not to worry about memory usage and execution speed until profiling shows you where the problem is, and I respect Knuth greatly as a thinker. Still, one may learn from others' experience and

Re: foreach - premature optimization vs cultivating good habits

2015-01-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote: As I understand it, foreach allocates when a simple C-style for using an array index would not. foreach is just syntax sugar over a for loop. If there's any allocations, it is because your code had some, it isn't inherit to the

foreach - premature optimization vs cultivating good habits

2015-01-30 Thread Laeeth Isharc via Digitalmars-d-learn
Hi. The standard advice is not to worry about memory usage and execution speed until profiling shows you where the problem is, and I respect Knuth greatly as a thinker. Still, one may learn from others' experience and cultivate good habits early. To say that one should not prematurely

Re: foreach - premature optimization vs cultivating good habits

2015-01-30 Thread BBaz via Digitalmars-d-learn
On Friday, 30 January 2015 at 11:55:16 UTC, Laeeth Isharc wrote: Hi. The standard advice is not to worry about memory usage and execution speed until profiling shows you where the problem is, and I respect Knuth greatly as a thinker. Still, one may learn from others' experience and