Skip to content

Improve performance of JohnsonSU #1976

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Improve performance of JohnsonSU #1976

wants to merge 1 commit into from

Conversation

devmotion
Copy link
Member

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-commenter
Copy link

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 86.30%. Comparing base (efff906) to head (08a653d).

Files with missing lines Patch % Lines
src/univariate/continuous/johnsonsu.jl 94.73% 1 Missing ⚠️
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     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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