Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCPP - optimize use of quantile / tdigest #11

Closed
rspadim opened this issue May 3, 2022 · 1 comment
Closed

RCPP - optimize use of quantile / tdigest #11

rspadim opened this issue May 3, 2022 · 1 comment

Comments

@rspadim
Copy link
Collaborator

rspadim commented May 3, 2022

> td=tdigest(x)
> microbenchmark(
+     tdigest::tdigest(x),
+     tdigest::tquantile(td, 0.4),
+     quantile(x, 0.4),
+     sort(x)
+ )
Unit: microseconds
                        expr       min         lq        mean    median         uq        max neval
         tdigest::tdigest(x) 81299.500 90134.1015 98235.96202 94811.951 98986.0005 272509.501   100
 tdigest::tquantile(td, 0.4)     5.702    11.5015    41.84706    31.551    42.4005    236.202   100
            quantile(x, 0.4) 12648.402 14265.2510 17013.55897 15825.701 17950.6510  28711.101   100
                     sort(x)  8111.701  9770.2010 12486.58689 11088.801 13189.7005  37959.101   100
@OVVO-Financial
Copy link
Owner

quantile was used because initializing or creating a t-digest structure is computationally expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants