Distributions.jl
Distributions.jl copied to clipboard
Improve performance of `JohnsonSU`
master
julia> using Distributions, Chairmarks, Random
julia> @be randn logpdf($(JohnsonSU(10, 10, 1, 3)), _)
Benchmark: 3581 samples with 873 evaluations
min 28.016 ns
median 29.353 ns
mean 29.809 ns
max 77.606 ns
julia> @be randn pdf($(JohnsonSU(10, 10, 1, 3)), _)
Benchmark: 1634 samples with 1235 evaluations
min 23.111 ns
median 23.245 ns
mean 23.672 ns
max 44.500 ns
julia> @be randn(Float32) logpdf($(JohnsonSU(10.0f0, 10.0f0, 1.0f0, 3.0f0)), _)
Benchmark: 3243 samples with 1173 evaluations
min 24.474 ns
median 24.546 ns
mean 25.004 ns
max 51.648 ns
julia> @be randn(Float32) pdf($(JohnsonSU(10.0f0, 10.0f0, 1.0f0, 3.0f0)), _)
Benchmark: 3319 samples with 1240 evaluations
min 23.051 ns
median 23.152 ns
mean 23.333 ns
max 38.273 ns
julia> @be rand!($(Random.default_rng()), $(JohnsonSU(10, 10, 1, 3)), $(Array{Float64}(undef, 100)))
Benchmark: 3271 samples with 33 evaluations
min 843.424 ns
median 862.364 ns
mean 870.551 ns
max 1.492 μs
This PR
julia> using Distributions, Chairmarks, Random
julia> @be randn logpdf($(JohnsonSU(10, 10, 1, 3)), _)
Benchmark: 4171 samples with 696 evaluations
min 27.418 ns
median 30.172 ns
mean 31.702 ns
max 161.579 ns
julia> @be randn pdf($(JohnsonSU(10, 10, 1, 3)), _)
Benchmark: 3907 samples with 871 evaluations
min 22.436 ns
median 22.675 ns
mean 24.059 ns
max 45.398 ns
julia> @be randn(Float32) logpdf($(JohnsonSU(10.0f0, 10.0f0, 1.0f0, 3.0f0)), _)
Benchmark: 4145 samples with 858 evaluations
min 22.970 ns
median 25.690 ns
mean 26.697 ns
max 69.882 ns
julia> @be randn(Float32) pdf($(JohnsonSU(10.0f0, 10.0f0, 1.0f0, 3.0f0)), _)
Benchmark: 2989 samples with 1428 evaluations
min 19.608 ns
median 21.943 ns
mean 22.560 ns
max 39.391 ns
julia> @be rand!($(Random.default_rng()), $(JohnsonSU(10, 10, 1, 3)), $(Array{Float64}(undef, 100)))
Benchmark: 4086 samples with 27 evaluations
min 750.000 ns
median 813.259 ns
mean 845.845 ns
max 1.546 μs
Codecov Report
:x: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 86.30%. Comparing base (efff906) to head (08a653d).
:warning: Report is 9 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/univariate/continuous/johnsonsu.jl | 94.73% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #1976 +/- ##
==========================================
+ Coverage 86.29% 86.30% +0.01%
==========================================
Files 146 146
Lines 8791 8805 +14
==========================================
+ Hits 7586 7599 +13
- Misses 1205 1206 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.