-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iteration performance #27
Comments
For example, this code can be optimizaed using foreach(r; iota(f1.height).parallel)
{
foreach(c; 0 .. f1.width)
{
auto id = r * f1.width + c;
f1s[r, c] = cast(float)f1d[id];
f2s[r, c] = cast(float)f2d[id];
}
} As Walter said, idiomatic D code should not have loops. This is really true for ndslice. |
I agree with everything you've stated. I assume we could include these changes in same basket as migration to Mir and ndslice.algorithm? |
Yes |
The code like |
Aw, man... :| Yea, I haven't cleaned optical flow modules, wanted to cut #58 short. Reopening... |
aSlice[i]
requires 1 addition and 1 multiplicationaSlice[i, j]
requires 2 additions and 2 multiplications90% of algorithm can be iterated using ndslice.algorithm (ndMap, ndReduce). Other 10% can use
front!d
,popFront!d
methodsThe text was updated successfully, but these errors were encountered: