Timeline for How to "convert" nested loops into code taking advantage of parallel computing?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 19, 2016 at 16:29 | comment | added | Mr Tsjolder from codidact |
@TrevörAnneDenise If the iteration count is a power of two, the modulo operation can be replaced by a bitwise & (assuming your architecture is base 2)
|
|
Nov 19, 2016 at 16:23 | comment | added | D.W.♦ |
@TrevörAnneDenise, I don't know. It probably depends on how much work doSomething() does. Note also that you can replace b := x mod 100 with b := x - 100*a , if that helps (a multiply might be faster than a remainder/mod, depending on the architecture). The best way to know for sure is probably to benchmark it.
|
|
Nov 19, 2016 at 16:10 | comment | added | Pop Flamingo | Thank you ! Somebody once told me that mod is pretty expensive, do you think I should be concerned about that in my case ? | |
Nov 19, 2016 at 16:07 | vote | accept | Pop Flamingo | ||
Nov 19, 2016 at 16:02 | history | answered | D.W.♦ | CC BY-SA 3.0 |