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

Use writeBin() for large objects? #106

Closed
wlandau opened this issue Jun 14, 2019 · 1 comment
Closed

Use writeBin() for large objects? #106

wlandau opened this issue Jun 14, 2019 · 1 comment

Comments

@wlandau
Copy link
Contributor

wlandau commented Jun 14, 2019

cc @nettoyoussef, re ropensci/drake#907 and #103.

storr/R/hash.R

Lines 61 to 63 in 2750823

## For current R (3.3.2 or thereabouts) writeBin does not work with
## long vectors. We can work around this for now, but in future
## versions this will just use native R support.

Is it time to allow writeBin() for versions of R where it works for large vectors? I.e. change

storr/R/hash.R

Line 94 in 2750823

if (len < long) {

to something like

if (r_version > min_r_version || len < long) {

I would be happy to check the R versions and platforms where writeBin() would work. From #103 (comment), I think this is one of the best things we can do to improve speed.

@wlandau
Copy link
Contributor Author

wlandau commented Jun 14, 2019

Turns out even R 3.6.0 lacks support for long vectors in writeBin().

> print(R.version$version.string)                                                            
[1] "R version 3.6.0 (2019-04-26)"                                                           
> data <- data.frame(x = runif(1e9))                                                         
> obj <- serialize(data, NULL, ascii = FALSE, xdr = TRUE)                                    
> con <- file(tempfile(), "wb")                                                              
> writeBin(obj, con)                                                                         
Error in writeBin(obj, con) :                                                                
  long vectors not supported yet: connections.c:4418                                         
Execution halted

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

No branches or pull requests

1 participant