Skip to content

Commit 1f055c1

Browse files
Implement blocking, loop unrolling
Reimplemented blocking of permutation ES. Additionally, the loops responsible for updating n_as_extreme have been restructured to facilitate unrolling by the compiler; this change greatly reduces the runtime on CPUs with small cache memory.
1 parent 188b864 commit 1f055c1

10 files changed

Lines changed: 401 additions & 184 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: fast.ssgsea
22
Type: Package
33
Title: High-Performance Gene Set Enrichment Analysis (HP-GSEA)
4-
Version: 0.1.0.9030
5-
Date: 2026-03-10
4+
Version: 0.1.0.9031
5+
Date: 2026-03-15
66
Authors@R:
77
person(given = "Tyler", family = "Sagendorf",
88
email = "tyler.sagendorf@pnnl.gov",

README.Rmd

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,27 @@ No Windows binary is available, so [Rtools](https://cran.r-project.org/bin/windo
4848

4949
### Linux
5050

51-
Most Linux distributions come pre-packaged with tools to compile C and C++ code, so no extra work needs to be done. Users can install the development version of `fast.ssgsea` on Linux by running the code below.
51+
Most Linux distributions come pre-packaged with tools to compile C and C++ code, so no extra work is needed. Users can install the development version of `fast.ssgsea` on Linux by running the code below.
5252

5353
### Install
5454

55-
The development version of `fast.ssgsea` can be installed with
55+
The development version of `fast.ssgsea` can be installed with any of the following
5656

5757
``` r
5858
# install.packages("pak")
5959
pak::pak("pnnl/fast.ssgsea")
6060
```
6161

62-
or
63-
6462
``` r
6563
# install.packages("devtools")
6664
devtools::install_github("pnnl/fast.ssgsea")
6765
```
6866

67+
``` r
68+
# install.packages("renv")
69+
renv::install("pnnl/fast.ssgsea")
70+
```
71+
6972
## Usage
7073

7174
### Simulate Data
@@ -131,7 +134,7 @@ print(sessionInfo(), locale = FALSE, tzone = FALSE)
131134

132135
## Performance
133136

134-
Tests were performed on a desktop computer with an AMD Ryzen 5 7600X CPU running at 4.7 GHz, single threaded, to measure the runtime of fast-ssGSEA (`fast.ssgsea::fast_ssgsea`) and FGSEA-simple (`fgsea::fgseaSimple`). Different combinations of the number of gene sets, maximum gene set size, and the number of permutations were tested in a random order (3 replicates each) to minimize the influence of previous runs. The R scripts and data are available in the simulation/ folder.
137+
Tests were performed on a desktop computer with an AMD Ryzen 5 7600X CPU running at 4.7 GHz, single threaded, to measure the runtime of fast-ssGSEA (`fast.ssgsea::fast_ssgsea`) and FGSEA-simple (`fgsea::fgseaSimple`). Different combinations of the number of gene sets, maximum gene set size, and the number of permutations ($\pi$) were tested in a random order (3 replicates each) to minimize the influence of previous runs. The R scripts and data are available in the simulation/ folder.
135138

136139
### fast-ssGSEA
137140

README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,29 @@ installed to compile C and C++ code. Then, the development version of
9393
### Linux
9494

9595
Most Linux distributions come pre-packaged with tools to compile C and
96-
C++ code, so no extra work needs to be done. Users can install the
97-
development version of `fast.ssgsea` on Linux by running the code below.
96+
C++ code, so no extra work is needed. Users can install the development
97+
version of `fast.ssgsea` on Linux by running the code below.
9898

9999
### Install
100100

101-
The development version of `fast.ssgsea` can be installed with
101+
The development version of `fast.ssgsea` can be installed with any of
102+
the following
102103

103104
``` r
104105
# install.packages("pak")
105106
pak::pak("pnnl/fast.ssgsea")
106107
```
107108

108-
or
109-
110109
``` r
111110
# install.packages("devtools")
112111
devtools::install_github("pnnl/fast.ssgsea")
113112
```
114113

114+
``` r
115+
# install.packages("renv")
116+
renv::install("pnnl/fast.ssgsea")
117+
```
118+
115119
## Usage
116120

117121
### Simulate Data
@@ -173,7 +177,7 @@ system.time({
173177
```
174178

175179
## user system elapsed
176-
## 1.323 0.106 1.348
180+
## 1.209 0.090 1.224
177181

178182
``` r
179183
str(res)
@@ -207,25 +211,26 @@ print(sessionInfo(), locale = FALSE, tzone = FALSE)
207211
## [1] stats graphics grDevices utils datasets methods base
208212
##
209213
## other attached packages:
210-
## [1] dqrng_0.4.1 fast.ssgsea_0.1.0.9030
214+
## [1] dqrng_0.4.1 fast.ssgsea_0.1.0.9031
211215
##
212216
## loaded via a namespace (and not attached):
213-
## [1] digest_0.6.37 collapse_2.1.3 fastmap_1.2.0 xfun_0.56
214-
## [5] knitr_1.50 parallel_4.5.2 htmltools_0.5.8.1 rmarkdown_2.29
215-
## [9] cli_3.6.5 data.table_1.17.8 compiler_4.5.2 rstudioapi_0.17.1
216-
## [13] tools_4.5.2 evaluate_1.0.5 Rcpp_1.1.0 yaml_2.3.10
217-
## [17] rlang_1.1.7
217+
## [1] digest_0.6.39 collapse_2.1.6 fastmap_1.2.0
218+
## [4] xfun_0.56 parallel_4.5.2 knitr_1.51
219+
## [7] htmltools_0.5.8.1 rmarkdown_2.29 cli_3.6.5
220+
## [10] data.table_1.18.2.1 compiler_4.5.2 rstudioapi_0.18.0
221+
## [13] tools_4.5.2 evaluate_1.0.5 Rcpp_1.1.1
222+
## [16] yaml_2.3.12 otel_0.2.0 rlang_1.1.7
218223

219224
## Performance
220225

221226
Tests were performed on a desktop computer with an AMD Ryzen 5 7600X CPU
222227
running at 4.7 GHz, single threaded, to measure the runtime of
223228
fast-ssGSEA (`fast.ssgsea::fast_ssgsea`) and FGSEA-simple
224229
(`fgsea::fgseaSimple`). Different combinations of the number of gene
225-
sets, maximum gene set size, and the number of permutations were tested
226-
in a random order (3 replicates each) to minimize the influence of
227-
previous runs. The R scripts and data are available in the simulation/
228-
folder.
230+
sets, maximum gene set size, and the number of permutations ($\pi$) were
231+
tested in a random order (3 replicates each) to minimize the influence
232+
of previous runs. The R scripts and data are available in the
233+
simulation/ folder.
229234

230235
### fast-ssGSEA
231236

man/figures/README-figure-1.png

3.27 KB
Loading

man/figures/README-figure-2.png

3.29 KB
Loading
-1 Bytes
Binary file not shown.

simulation/figures/figure-1.pdf

15 Bytes
Binary file not shown.

simulation/figures/figure-2.pdf

119 Bytes
Binary file not shown.

simulation/scripts/manuscript_figures.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,17 @@ time_res <- prepare_data("../data/fast-ssGSEA_timing_results.rds")
141141
142142
# 10,000 permutations
143143
pa <- filter(time_res, nperm == levels(nperm)[1L]) %>%
144-
plot_time(y_breaks = seq(0, 1, 0.25), y_max = 1, expand_upper = 5e-3) +
144+
plot_time(y_breaks = seq(0, 1, 0.2), y_max = 1, expand_upper = 0.05) +
145145
labs(x = "")
146146
147147
# 100,000 permutations
148148
pb <- filter(time_res, nperm == levels(nperm)[2L]) %>%
149-
plot_time(y_breaks = seq(0, 2.5, 0.5), y_max = 2.5, expand_upper = 5e-3) +
149+
plot_time(y_breaks = seq(0, 2, 0.4), y_max = 2, expand_upper = 0.05) +
150150
labs(y = "")
151151
152152
# 1,000,000 permutations
153153
pc <- filter(time_res, nperm == levels(nperm)[3L]) %>%
154-
plot_time(y_breaks = seq(0, 25, 5), y_max = 25, expand_upper = 5e-3) +
154+
plot_time(y_breaks = seq(0, 12, 2), y_max = 12, expand_upper = 0.05) +
155155
labs(x = "", y = "")
156156
157157
# Combine plots
@@ -186,17 +186,17 @@ time_res <- prepare_data("../data/FGSEA_timing_results_nproc_1.rds")
186186
187187
# 10,000 permutations
188188
pa <- filter(time_res, nperm == levels(nperm)[1L]) %>%
189-
plot_time(y_breaks = seq(0, 25, 5), y_max = 26, expand_upper = 5e-3) +
189+
plot_time(y_breaks = seq(0, 24, 4), y_max = 26, expand_upper = 5e-3) +
190190
labs(x = "")
191191
192192
# 100,000 permutations
193193
pb <- filter(time_res, nperm == levels(nperm)[2L]) %>%
194-
plot_time(y_breaks = seq(0, 250, 50), y_max = 260, expand_upper = 5e-3) +
194+
plot_time(y_breaks = seq(0, 240, 40), y_max = 260, expand_upper = 5e-3) +
195195
labs(y = "")
196196
197197
# 1,000,000 permutations
198198
pc <- filter(time_res, nperm == levels(nperm)[3L]) %>%
199-
plot_time(y_breaks = seq(0, 2500, 500), y_max = 2600, expand_upper = 5e-3) +
199+
plot_time(y_breaks = seq(0, 2400, 400), y_max = 2600, expand_upper = 5e-3) +
200200
labs(x = "", y = "")
201201
202202
# Combine plots

0 commit comments

Comments
 (0)