Re: [Rd] qnbinom with small size is slow

2020-08-24 Thread Martin Maechler
> Constantin Ahlmann-Eltze > on Fri, 21 Aug 2020 11:51:13 +0200 writes: > Hi Martin, thanks for verifying. I agree that the > Cornish-Fisher seems to struggle with the small size > parameters, but I also don't have a good idea how to > replace it. > But I think fi

Re: [Rd] qnbinom with small size is slow

2020-08-21 Thread Constantin Ahlmann-Eltze via R-devel
Hi Martin, thanks for verifying. I agree that the Cornish-Fisher seems to struggle with the small size parameters, but I also don't have a good idea how to replace it. But I think fixing do_search() is possible: I think the problem is that when searching to the left y is decremented only if `pnb

Re: [Rd] qnbinom with small size is slow

2020-08-20 Thread Martin Maechler
> Constantin Ahlmann-Eltze via R-devel > on Mon, 10 Aug 2020 10:05:36 +0200 writes: > Thanks Ben for verifying the issue. It is always reassuring to hear > when others can reproduce the problem. > I wrote a small patch that fixes the issue > (https://github.com/r-deve

Re: [Rd] qnbinom with small size is slow

2020-08-10 Thread Constantin Ahlmann-Eltze via R-devel
Thanks Ben for verifying the issue. It is always reassuring to hear when others can reproduce the problem. I wrote a small patch that fixes the issue (https://github.com/r-devel/r-svn/pull/11): diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c index b313ce56b2..d2e8d98759 100644 --- a/src/nm

Re: [Rd] qnbinom with small size is slow

2020-08-07 Thread Ben Bolker
   I can reproduce this on R Under development (unstable) (2020-07-24 r78910) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Pop!_OS 18.04 LTS   In my opinion this is worth reporting, but discussing it here first was a good idea.  Many more people read this list than watch the bug track

[Rd] qnbinom with small size is slow

2020-08-07 Thread Constantin Ahlmann-Eltze via R-devel
Hi all, I recently noticed that `qnbinom()` can take a long time to calculate a result if the `size` argument is very small. For example qnbinom(0.5, mu = 3, size = 1e-10) takes ~30 seconds on my computer. I used gdb to step through the qnbinom.c implementation and noticed that in line 106 (ht