Skip to content

Leverage ALTREP class for replicated vectors #25

Description

@mitchelloharawild

When replicating vecvec objects, the positional index can be more efficiently represented by storing the number of replicates.

z <- rep(1, 1e6)
pryr::object_size(z)
#> 8.00 MB

Created on 2026-05-27 with reprex v2.1.1

an 'alt rep' ALTREP class 😉 would make vecvec substantially more efficient within data analysis workflows, since the positional index of copies is often replications of regular ALTREP sequences.

For example, in mixtime you might have 1e6 time series for the exact same 1000 time points, for a total of 1e9 time points. The vecvec positions for this scenario would be rep(1:1000, 1e6)), which cannot currently be represented with ALTREP (requiring 8GB of memory!). This could (hopefully) be represented in just a few bytes with an ALTREP sequence for 1:1000, which is referenced in an ALTREP replication that additionally stores the number of replicates, 1e6.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions