Skip to content

Conversation

@jangorecki
Copy link
Member

@jangorecki jangorecki commented Aug 27, 2025

This PR is fresh attempt of #5441 which has been split in multiple smaller PRs.
10 smaller PRs have been already individually reviewed and merged to this dev branch, which now here is proposed to master.

This PR will supersede the following PRs: #5441, #5890, #5891, #5892, #5893, #5894, #5895, #5896, #5897, #5898

Scope

Closes #5438, #4968 and #5306.

Benchmarks

  • adaptive left aligned rolling max (algo="exact" only); benchmark code in NEWS.md file
#Unit: milliseconds
#       expr        min         lq       mean     median         uq        max neval
#   baser(x) 3094.88357 3097.84966 3186.74832 3163.58050 3251.66753 3370.33785    10
#      sj(x) 2221.55456 2255.12083 2306.61382 2303.47883 2346.70293 2412.62975    10
#   frmax(x)   17.45124   24.16809   28.10062   28.58153   32.79802   34.83941    10
# frapply(x)  272.07830  316.47060  366.94771  396.23566  416.06699  421.38701    10
  • simple rolling max use case against very fast roll library
library(roll)
library(data.table)
set.seed(108)
x = rnorm(1e8)
n = 1e5
system.time(
  a1 <- roll_max(x, n)
)
#   user  system elapsed 
#  1.144   0.266   1.411
system.time(
  a2 <- frollmax(x, n)
)
#   user  system elapsed 
#  0.178   0.264   0.443
all.equal(a1, a2)
#[1] TRUE

This work was supported by the Medical Research Council, UK [grant number 1573].

jangorecki and others added 27 commits May 6, 2025 17:06
* frollmax exact, buggy fast, no fast adaptive

* frollmax fast fixing bugs

* frollmax man to fix CRAN check

* frollmax fast adaptive non NA, dev

* froll docs, adaptive left

* no frollmax fast adaptive

* frollmax adaptive exact NAs handling

* PR summary in news

* align happens in one place, less duplicated code

* push up even more to frollR to reduce code duplication

* frollapply push up align arg and early stopping up

* typo fix in NEWS.md

Co-authored-by: Marco Colombo <[email protected]>

* keep R agnostic C code in froll.c, yet deduplicated

* new functionality unit tests

* doc further improving

* tests and NEWS

* remove unnecessary new line to reduce diff

* Many wording corrections by Ben

Co-authored-by: Benjamin Schwendinger <[email protected]>

* function args, suggested by Ivan

* Add wording improvements by Ivan

Co-authored-by: aitap <[email protected]>

* follow up improvements added to TODO file

---------

Co-authored-by: Marco Colombo <[email protected]>
Co-authored-by: Benjamin Schwendinger <[email protected]>
Co-authored-by: aitap <[email protected]>
* catf rather than cat

* malloc and free as per feedback

* remove R < 3.4.0 related code

* rm TODO file
Copy link
Member

@tdhock tdhock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Co-authored-by: Marco Colombo <[email protected]>
@jangorecki
Copy link
Member Author

jangorecki commented Aug 28, 2025

For now I have reverted atime test script and merged fresh master, to have this PR in a ready-to-merge state.
I am of course open to add atime script but I am not sure if it's feasible now, as per in-line comments in previous commits.

@tdhock
Copy link
Member

tdhock commented Aug 28, 2025

that is fine, no need to add atime tests, lgtm.

Copy link
Member

@ben-schwen ben-schwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small things but overall LGTM

Co-authored-by: Marco Colombo <[email protected]>
@jangorecki jangorecki merged commit 3bb2e76 into master Aug 28, 2025
12 checks passed
@jangorecki jangorecki added this to the 1.18.0 milestone Sep 9, 2025
@jangorecki jangorecki deleted the froll2025max branch September 27, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adaptive, left-aligned rolling max

6 participants