Comments (2)
Modifying OnceDifferentiable to
mutable struct OnceDifferentiable{F, DF, FDF, TF, TDF, TX} <: AbstractObjective
f::F # objective
df::DF # (partial) derivative of objective
fdf::FDF # objective and (partial) derivative of objective
F::TF # cache for f output
DF::TDF # cache for df output
x_f::TX # x used to evaluate f (stored in F)
x_df::TX # x used to evaluate df (stored in DF)
f_calls::Vector{Int}
df_calls::Vector{Int}
end
I see
0.000015 seconds (3 allocations: 224 bytes)
0.000005 seconds (1 allocation: 160 bytes)
0.000001 seconds (3 allocations: 960 bytes)
0.000000 seconds (1 allocation: 896 bytes)
0.000002 seconds (4 allocations: 8.016 KiB)
0.000001 seconds (2 allocations: 7.953 KiB)
0.000011 seconds (5 allocations: 78.281 KiB)
0.000011 seconds (3 allocations: 78.219 KiB)
0.000178 seconds (5 allocations: 781.406 KiB)
0.000110 seconds (3 allocations: 781.344 KiB)
305.021 ns (3 allocations: 224 bytes)
53.191 ns (1 allocation: 160 bytes)
326.941 ns (3 allocations: 960 bytes)
86.506 ns (1 allocation: 896 bytes)
850.000 ns (3 allocations: 8.00 KiB)
596.154 ns (1 allocation: 7.94 KiB)
6.100 μs (4 allocations: 78.27 KiB)
4.520 μs (2 allocations: 78.20 KiB)
45.800 μs (4 allocations: 781.39 KiB)
47.400 μs (2 allocations: 781.33 KiB)
BTW, a similar problem could arise in other objective types too.
from nlsolversbase.jl.
Yeah, this is because it's not type stable. This was on purpose to avoid recompilation. I can benchmark it again. The reason is that there's dynamic dispatch which causes allocations.
from nlsolversbase.jl.
Related Issues (20)
- link to julianlsolvers fails HOT 1
- [doc] explicit definition of arguments HOT 8
- non-modifying fg HOT 13
- Complex-valued gradients broken HOT 7
- Joint Hessian and Jacobian evaluation using the TwiceDifferentiable type HOT 1
- Add option to specify ForwardDiff chunk size HOT 4
- Extending autodiff compatibilities HOT 4
- Slow loading HOT 1
- Himmelblau references in README.md HOT 2
- TagBot trigger issue HOT 7
- allow using other array types in TwiceOrderDifferentiable finite differences HOT 3
- Message from JET HOT 1
- Is there any documentation?
- sparse AD on OnceDifferentiableConstraints and TwiceDifferentiableConstraints
- Why are`f_calls`, `df_calls` and `h_calls` all `Vector{Int}`? HOT 1
- Precompiling NLSolversBase for Julia v 1.0.0 fails. HOT 4
- 1.0 development HOT 2
- Higher dimensionnal Hessian HOT 2
- Incorrect initialization of derivative storage HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlsolversbase.jl.