[Rd] `sort` hanging without R_CheckUserInterrupt()

Aidan Lakshman AHL27 @end|ng |rom p|tt@edu
Wed Feb 21 21:10:35 CET 2024


Hi everyone,

Just a quick question/problem I encountered, wanted to make sure this is known behavior. Running `sort` on a long vector can take quite a bit of time, and I found today that there don’t seem to be any calls to `R_CheckUserInterrupt()` during execution. Calling something like `sort((2^31):1)` takes good bit of time to run on my machine and is uninterruptable without force-terminating the entire R session.

There doesn’t seem to be any mention in the help files that this method is uninterruptable. All the methods called from `sortVector` in `src/main/sort.c` lack checks for user interrupts as well.

My main question is, is this known behavior? Is it worth including a warning in the help file? I don’t doubt that including a bunch of `R_CheckUserInterrupt()` calls would really hurt performance, but it may be possible to add an occasional call if `sort` is called on a long vector.

This may not even be a problem that affects people, which is my main reason for inquiring.

-Aidan



-----------------------
Aidan Lakshman (he/him)
www.AHL27.com



More information about the R-devel mailing list