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

Improve performance of derivative with FiniteDifferences and ForwardDiff #97

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

devmotion
Copy link
Member

Fixes #87. With this PR, the benchmark in #87 yields on my computer

julia> @benchmark with_AD(1.)
BenchmarkTools.Trial: 10000 samples with 960 evaluations.
 Range (min  max):  87.060 ns   1.505 μs  ┊ GC (min  max): 0.00%  88.90%
 Time  (median):     89.291 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   92.532 ns ± 30.948 ns  ┊ GC (mean ± σ):  0.75% ±  2.17%

  █▆▆▆▃▂ ▄▅▄▂▁▁▁ ▄▂▁▁                                       ▁ ▂
  ███████████████████▇▆▇▇█▇▇▇▇▆▅▆▅▅▅▅▄▄▃▃▄▄▁▆▃▁▃▄▃▃▅▃▃▁▁▄█▆▄█ █
  87.1 ns      Histogram: log(frequency) by time       138 ns <

 Memory estimate: 32 bytes, allocs estimate: 2.

julia> @benchmark without_AD(1.)
BenchmarkTools.Trial: 10000 samples with 961 evaluations.
 Range (min  max):  86.429 ns   1.699 μs  ┊ GC (min  max): 0.00%  91.77%
 Time  (median):     89.110 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   91.506 ns ± 35.367 ns  ┊ GC (mean ± σ):  0.90% ±  2.23%

  ▃█▇▃▃██▄▄▂▁   ▂▃▄▄▄▂▁▁       ▃▂                             ▂
  ████████████▇██████████▇██▇▇████▇███▆▆▅▂▅▄▅▇█████▅▅▆▆▅▆▅▂▃▆ █
  86.4 ns      Histogram: log(frequency) by time       113 ns <

 Memory estimate: 32 bytes, allocs estimate: 2.

@codecov
Copy link

codecov bot commented Jul 29, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.13% 🎉

Comparison is base (041d760) 84.25% compared to head (8ba18a0) 84.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
+ Coverage   84.25%   84.38%   +0.13%     
==========================================
  Files           8        8              
  Lines         470      474       +4     
==========================================
+ Hits          396      400       +4     
  Misses         74       74              
Files Changed Coverage Δ
ext/AbstractDifferentiationFiniteDifferencesExt.jl 100.00% <100.00%> (ø)
ext/AbstractDifferentiationForwardDiffExt.jl 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Include dedicated derivative functions for FiniteDifferences/ForwardDiff instead of relying on jacobians?
2 participants