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

Add function to transfer data between callbacks and matrices #11

Merged
merged 1 commit into from
Dec 21, 2020

Conversation

frapac
Copy link
Member

@frapac frapac commented Dec 21, 2020

Before that PR, the data transfer occurred directly in the main function, preventing Julia compiler to infer type properly. This resulted in additional --- and unwanted --- allocations. A quick profiling using BenchmarkTools gives on main:

julia> include("profiling/qptest.jl")
  520.067 μs (6005 allocations: 141.88 KiB)
:Solve_Succeeded

By moving the transfer routine in a separate function, we allow a better specialization in the compiler, and a decrease in a number of allocations as types are inferred properly. With this PR, we get:

julia> include("profiling/qptest.jl")
  177.643 μs (49 allocations: 33.17 KiB)
:Solve_Succeeded

See #10

@frapac frapac requested a review from youngdae December 21, 2020 14:07
Copy link
Member

@youngdae youngdae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. It seems that modularization greatly helps optimize the code.

@youngdae youngdae merged commit 75f1547 into main Dec 21, 2020
@frapac frapac deleted the fp/transfer branch December 21, 2020 15:36
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

Successfully merging this pull request may close these issues.

2 participants