← Back to all sparks
V

vecvec

ANALYTICS
Velocity0.0

R package vecvec by mitchelloharawild — release notes from GitHub.

A vector-of-vectors class swapped its object system mid-flight and came out faster.

r-packagedata-structuress7vctrsperformancealtrep
Current state
vecvec provides an R class that holds multiple vectors as a single logical vector without copying them together, aimed at cases where concatenating would be wasteful. The 1.0.0 rewrite moved the class off vctrs onto S7 while keeping user-facing code working, and added matrix and array behaviour. Recent releases have concentrated on the details that decide whether the abstraction actually saves work: ALTREP vectors surviving intact, subassignment edge cases, and printing that does not materialise what it is describing.
Where it's heading
The arc runs from proving the idea to making it cheap. Early releases established constructors and vctrs dispatch; 1.0.0 rebuilt the internals on S7 with a smaller, faster representation and automatic flattening of adjacent compatible vectors; the two releases since have been about not defeating the point — an ALTREP vector flattened on construction or materialised by a print method gives back exactly the memory the class exists to save. Extensibility is the other visible thread, with custom ptype2 and cast methods now registrable and extension packages expected to subclass class_vecvec. The internal index structure is explicitly reserved for future change, so faster special-case representations look planned rather than incidental.
Prediction
The reserved internal structure and the stated intent to accommodate faster variants point at specialised representations for particular vector types next; the entries do not indicate which cases are queued first.

Recent moves

  1. 1mo ago

    Extension packages can register their own ptype and cast methods

    Custom vec_ptype2 and vec_cast registration is the extensibility counterpart to the S7 move: after 1.0.0 told extension authors to subclass class_vecvec, this gives them the type-coercion hooks to make those subclasses behave. The empty-object printing fix is small, but consistent with a release series spent on presentation and edge cases.

    View source ↗
  2. 1mo ago

    ALTREP vectors survive construction and printing intact

    Two changes that protect the package's core premise: ALTREP vectors are no longer flattened when a vecvec is built, and the print method respects max.print rather than materialising the object to display it. A class built to avoid copying vectors together loses its reason to exist the moment routine operations expand them, so this is corrective work on the abstraction itself, alongside two subassignment fixes involving NA and zero-length indices.

    View source ↗
  3. 3mo ago

    The class is rebuilt on S7, with a new internal representation

    ⚡ SPARK

    The pivot the rest of the log hangs off: vecvec is reimplemented on S7 instead of vctrs, with an overhauled internal structure, matrix and array support, and substantially better speed and object size. User code mostly survives, but extension packages and anything touching new_vecvec() do not.

    View source ↗
  4. 4mo ago

    Missing value handling fixed for is.na()

    A single bug fix on NA handling, shipped weeks before the S7 rewrite that replaced the implementation underneath it.

    View source ↗
  5. 11mo ago

    Arithmetic and per-vector apply arrive

    vec_math() and vec_apply() turn the class from a container into something you can compute over, with vec_apply() operating on each constituent vector rather than the flattened whole — the operation that makes the structure worth keeping. Record-type support and several Ops and casting fixes round out the release that took the package to CRAN.

    View source ↗
  6. 11mo ago

    First release: constructors and vctrs dispatch

    The initial public surface — constructors, an unvecvec() deconstructor back to atomic vectors, and vctrs method dispatch. The vctrs foundation established here is precisely what 1.0.0 later replaced with S7.

    View source ↗