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

Remove abstract fields #66

Merged
merged 2 commits into from
Oct 8, 2019

Conversation

devmotion
Copy link
Contributor

This PR gets rid of the abstract fields by adding type parameters. It is a subset of the changes in #49.

A quick benchmark

using Bootstrap
using BenchmarkTools                                                                      
using StatsBase                              

function test_mean_and_std(n)                                                             
    r = rand(25)                                                                          
    sampling = BasicSampling(n)

    @btime bootstrap($mean_and_std, $r, $sampling)                                        
end                                          

function test_bca_conf_int(n)                                                             
    sample = bootstrap(mean_and_std, rand(25), BasicSampling(n))                          
    ci = BCaConfInt(0.95)                                                                 

    @btime confint($sample, $ci)
end                     

yields on the develop branch

julia> test_mean_and_std(100); 
  28.043 μs (8 allocations: 2.25 KiB)

julia> test_mean_and_std(1_000);                               
  287.129 μs (8 allocations: 16.38 KiB)      

julia> test_bca_conf_int(100);               
  29.124 μs (347 allocations: 33.13 KiB)     

julia> test_bca_conf_int(1_000);             
  134.613 μs (351 allocations: 47.53 KiB)    

and with this PR

julia> test_mean_and_std(100);     
  25.590 μs (5 allocations: 2.11 KiB)        

julia> test_mean_and_std(1_000);                                                          
  263.614 μs (5 allocations: 16.23 KiB)

julia> test_bca_conf_int(100);              
  12.927 μs (242 allocations: 30.81 KiB)

julia> test_bca_conf_int(1_000); 
  113.563 μs (242 allocations: 45.16 KiB)

@juliangehring juliangehring merged commit 9e25695 into juliangehring:develop Oct 8, 2019
@juliangehring
Copy link
Owner

Great, thanks!

@devmotion devmotion deleted the proper_typing branch October 9, 2019 05:24
@juliangehring juliangehring mentioned this pull request Jan 3, 2021
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.

None yet

2 participants