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

avoid abstract types #1

Open
johnnychen94 opened this issue Jun 18, 2021 · 0 comments
Open

avoid abstract types #1

johnnychen94 opened this issue Jun 18, 2021 · 0 comments

Comments

@johnnychen94
Copy link
Member

See https://docs.julialang.org/en/v1/manual/performance-tips/#Avoid-fields-with-abstract-type

This introduces unnecessary runtime overheads:

using BenchmarkTools, OpenCV

A_abs = rand(5,4,3);
A = OpenCV.Mat(A_abs);

@btime size($A); # 15.539 ns (1 allocation: 32 bytes)
@btime size($A_abs); # 1.430 ns (0 allocations: 0 bytes)

Looks like Mat and Vec should be updated accordingly. There might be some other cases, though.

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

No branches or pull requests

1 participant