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

have threshold to materialize when subsetting down a lot #12

Open
EmilHvitfeldt opened this issue Apr 19, 2024 · 0 comments
Open

have threshold to materialize when subsetting down a lot #12

EmilHvitfeldt opened this issue Apr 19, 2024 · 0 comments
Labels
feature a feature request or enhancement Future Not going to happen anytime soon

Comments

@EmilHvitfeldt
Copy link
Member

I don't know if I love this idea, but it could be useful

library(sparsevctrs)

# long sparse vector
x_long <- new_sparse_real(c(1, 5, 10), c(1, 5, 10), 10000000000)

altrepr::is_altrep(x_long)
#> [1] TRUE
lobstr::obj_size(x_long)
#> 1.24 kB

# short sparse vector
x_short <- x_long[1:2]

altrepr::is_altrep(x_short)
#> [1] TRUE
lobstr::obj_size(x_short)
#> 1.21 kB

# short dense vector
x_dense <- x_short[]

altrepr::is_altrep(x_dense)
#> [1] FALSE
lobstr::obj_size(x_dense)
#> 64 B

Created on 2024-04-19 with reprex v2.1.0

@EmilHvitfeldt EmilHvitfeldt added the feature a feature request or enhancement label Apr 19, 2024
@EmilHvitfeldt EmilHvitfeldt added the Future Not going to happen anytime soon label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement Future Not going to happen anytime soon
Projects
None yet
Development

No branches or pull requests

1 participant