From 856331c9dd7b876e0ac0e38c96bffe9cfffe9876 Mon Sep 17 00:00:00 2001 From: Oskar Laverny Date: Wed, 24 Apr 2024 16:54:24 +0200 Subject: [PATCH] Add benchmarks directly in the docs (#26) * let's try * better * add a sample bench -- not sure if it is the right way to go. --- docs/Project.toml | 5 +++-- docs/make.jl | 1 + docs/src/benches.md | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 docs/src/benches.md diff --git a/docs/Project.toml b/docs/Project.toml index bb38ce8..ee29468 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,7 +1,8 @@ [deps] +BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589" -RateTables = "d40fb65e-c2ee-4113-9e14-cb96ca0acb32" -RCall = "6f49c342-dc21-5d91-9882-a32aef131414" NetSurvival = "8f9d5d0e-dd2e-4568-92d4-f8c5d34f25cf" +RCall = "6f49c342-dc21-5d91-9882-a32aef131414" +RateTables = "d40fb65e-c2ee-4113-9e14-cb96ca0acb32" diff --git a/docs/make.jl b/docs/make.jl index 67721a6..4cadd11 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -23,6 +23,7 @@ makedocs(; "Home" => "index.md", "theory.md", "getting_started.md", + "benches.md", "references.md", ], ) diff --git a/docs/src/benches.md b/docs/src/benches.md new file mode 100644 index 0000000..86c6e3c --- /dev/null +++ b/docs/src/benches.md @@ -0,0 +1,35 @@ +```@meta +CurrentModule = NetSurvival +``` + +# Benchmarking results + +The following benchmarks are run on github actions continuous integration platform, which is a very slow computing engine. Local experiments suggests performances that are twice as fast on correct hardware -- note that we do not use multithreading at all, but underlying BLAS calls might. + +```@example 1 +using RCall +using NetSurvival, RateTables, BenchmarkTools + +R_bench = @benchmark R""" +relsurv::rs.surv( + survival::Surv(time, stat) ~1, + rmap=list(age = age, sex = sex, year = diag), + data = relsurv::colrec, + ratetable = relsurv::slopop, + method = "pohar-perme", + add.times=1:8149) +""" + +jl_bench = @benchmark fit(PoharPerme, @formula(Surv(time,status)~1), colrec, slopop) + +ratio = time(minimum(R_bench)) / time(minimum(jl_bench)) +``` + + +# Benchmarking across time + +The folloiwng charts provide a glimpse of `NetSurvival.jl`'s performance along time: + +```@raw html + +``` \ No newline at end of file