in reply to faster way for multiple foreach loops
that means you actually execute the whole thing M=(d1e - d1s)*(d2e - d2s)*(d3e - d3s)*...*(dne - dns) times
So that means you can make a single loop 1..M and now you're left with the problem of extracting from the counter all the n counters you had initially.
If all the intervals you considered initially were equal(let's say the interval was I long) you could just write the new counter in base I and you get the initial indexes,but otherwise...it would probably be a bit more complicated.
You probably should convince yourself if the overhead in additional calculations is worth the effort. Good luck :)
|
|---|