Measurements.jl icon indicating copy to clipboard operation
Measurements.jl copied to clipboard

Switch to FiniteDifferences for `@uncertain`

Open giordano opened this issue 4 years ago • 3 comments

giordano avatar Nov 23 '20 01:11 giordano

Codecov Report

Merging #82 (88f4616) into master (b8f57d0) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #82   +/-   ##
=======================================
  Coverage   97.09%   97.09%           
=======================================
  Files          12       12           
  Lines         688      688           
=======================================
  Hits          668      668           
  Misses         20       20           
Impacted Files Coverage Δ
src/Measurements.jl 88.88% <ø> (ø)
src/math.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e18b75a...eb16b51. Read the comment docs.

codecov-io avatar Nov 23 '20 01:11 codecov-io

Codecov Report

Merging #82 (99bbf00) into master (dc99187) will decrease coverage by 0.13%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #82      +/-   ##
==========================================
- Coverage   95.56%   95.43%   -0.14%     
==========================================
  Files          13       13              
  Lines         744      744              
==========================================
- Hits          711      710       -1     
- Misses         33       34       +1     
Impacted Files Coverage Δ
src/Measurements.jl 87.09% <ø> (ø)
src/math.jl 97.92% <100.00%> (ø)
src/conversions.jl 96.00% <0.00%> (-4.00%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Jun 01 '21 23:06 codecov-commenter

For the record, with Julia v1.8.0 and Measurements.jl v2.8.0:

julia> using BenchmarkTools, Measurements

julia> @benchmark @uncertain atan($(10), $(13.5 ± 0.8))
BenchmarkTools.Trial: 10000 samples with 156 evaluations.
 Range (min … max):  672.096 ns …  19.063 μs  ┊ GC (min … max): 0.00% … 95.48%
 Time  (median):     707.747 ns               ┊ GC (median):    0.00%
 Time  (mean ± σ):   767.266 ns ± 766.993 ns  ┊ GC (mean ± σ):  4.52% ±  4.36%

  ▃▆██▇▅▄▃▂▂▁▂▁▂▂▂▂▂▁▂▂▁▁▁▁                                     ▂
  ███████████████████████████▇▇▆▅▇▆▅▄▅▄▅▄▄▄▅▃▅▄▁▃▄▃▁▅▁▃▃▁▃▁▁▄▃▃ █
  672 ns        Histogram: log(frequency) by time       1.28 μs <

 Memory estimate: 656 bytes, allocs estimate: 20.

julia> @benchmark @uncertain log($(9.4 ± 1.3), $(58.8 ± 3.7))
BenchmarkTools.Trial: 10000 samples with 178 evaluations.
 Range (min … max):  611.197 ns … 25.339 μs  ┊ GC (min … max): 0.00% … 96.77%
 Time  (median):     666.593 ns              ┊ GC (median):    0.00%
 Time  (mean ± σ):   758.990 ns ±  1.039 μs  ┊ GC (mean ± σ):  7.03% ±  5.00%

  ▄▆██▇▆▄▄▃▃▃▃▂▂▂▁▂▁▁▁                                         ▂
  ████████████████████████▇▇▇▇▇█▆▆▆▅▅▆▇▆▄▅▆▆▅▅▅▄▅▅▅▃▄▄▅▂▃▄▅▄▄▄ █
  611 ns        Histogram: log(frequency) by time      1.46 μs <

 Memory estimate: 704 bytes, allocs estimate: 21.

On this PR, with the same version of julia:

julia> using BenchmarkTools, Measurements

julia> @benchmark @uncertain atan($(10), $(13.5 ± 0.8))
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
 Range (min … max):  14.856 μs …  4.743 ms  ┊ GC (min … max): 0.00% … 98.94%
 Time  (median):     17.639 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   19.779 μs ± 78.117 μs  ┊ GC (mean ± σ):  6.77% ±  1.71%

      ▁▅█▄                                                     
  ▂▅███████▆▅▄▄▃▃▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
  14.9 μs         Histogram: frequency by time        39.7 μs <

 Memory estimate: 13.33 KiB, allocs estimate: 257.

julia> @benchmark @uncertain log($(9.4 ± 1.3), $(58.8 ± 3.7))
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
 Range (min … max):  13.204 μs …  5.703 ms  ┊ GC (min … max): 0.00% … 99.20%
 Time  (median):     16.075 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   19.445 μs ± 92.030 μs  ┊ GC (mean ± σ):  8.10% ±  1.72%

  ▁▅▆▇██▇▆▆▅▄▃▃▃▂▂▂▁     ▁▁▁▁                                 ▂
  █████████████████████████████▇██▇███▆▆▇▆▆▆▇▇▆▇▆▇▇▇▇▇▇▆▇▆▆▆▆ █
  13.2 μs      Histogram: log(frequency) by time      42.5 μs <

 Memory estimate: 13.28 KiB, allocs estimate: 256.

This change doesn't seem to go into the right direction. Add to the fact I had to relax tolerance in a couple of @uncertain tests.

giordano avatar Sep 01 '22 22:09 giordano