Skip to content
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

Open
9il opened this issue Aug 16, 2016 · 5 comments
Open

Iteration performance #27

9il opened this issue Aug 16, 2016 · 5 comments
Assignees
Milestone

Comments

@9il
Copy link
Member

9il commented Aug 16, 2016

aSlice[i] requires 1 addition and 1 multiplication
aSlice[i, j] requires 2 additions and 2 multiplications
90% of algorithm can be iterated using ndslice.algorithm (ndMap, ndReduce). Other 10% can use front!d, popFront!d methods

@9il
Copy link
Member Author

9il commented Aug 16, 2016

For example, this code can be optimizaed using assumeSameStructure (zip analog) and ndEach

        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.

@ljubobratovicrelja
Copy link
Member

I agree with everything you've stated. I assume we could include these changes in same basket as migration to Mir and ndslice.algorithm?

@9il
Copy link
Member Author

9il commented Aug 16, 2016

Yes

@9il
Copy link
Member Author

9il commented Nov 12, 2016

@ljubobratovicrelja
Copy link
Member

Aw, man... :| Yea, I haven't cleaned optical flow modules, wanted to cut #58 short. Reopening...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants