Skip to content

v1.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 31 Jul 14:00
· 116 commits to main since this release

VectorPro v1.0.0

The first stable release of VectorPro, a configurable, header-only dynamic
array for modern C++20.

Highlights

  • Contiguous, random-access iterator satisfying std::contiguous_iterator.
  • Configurable growth policy via GrowthNum/GrowthDen template parameters.
  • Custom allocator support through std::allocator_traits.
  • push_back(), emplace_back(), insert(), and emplace() with aliasing-safe
    handling of self-referencing values during reallocation.
  • erase(), remove_if(), pop_back(), and clear() for element removal.
  • reserve() and shrink_to_fit() for explicit capacity management.
  • Copy and move construction/assignment, allocator-aware and exception-safe.
  • operator== and operator<=> for full lexicographical comparison.
  • as_span() for zero-copy std::span views over the underlying storage.
  • contains() and find() lookups.
  • Member and free swap().
  • Iterator-pair and initializer-list construction.
  • Optional, zero-overhead modification-event notifications via
    subscribe()/unsubscribe(), enabled through the ObservableVector alias.
  • rain:: namespace alias for both Vector and Iterator.

Performance

The implementation is designed to match or beat std::vector on common paths
while staying predictable at scale.

  • memcpy-based fast paths for trivially copyable types with the default
    allocator in reallocate(), copyBufferFrom(), copy assignment, and
    operator==.
  • Saturating growth calculation (growCapacity()) avoids overflow on repeated
    doubling and guarantees strict capacity growth even under unusual growth
    ratios.
  • [[no_unique_address]] listener storage means a plain Vector (events
    disabled) carries zero bytes of bookkeeping for the notification system —
    the if constexpr in notify() compiles the call away entirely.
  • Cold/hot path split in push_back(): the common no-growth case stays small
    enough to inline, while the reallocation path is factored out separately.

Benchmarks

Measured against std::vector at 10K / 100K / 1M iterations. Full results:
benchmarks/results/v1_0_0.md.

Operation VectorPro (1M) std::vector (1M) Δ
Pop Back 63.81 ms 577.46 ms +804.9%
Erase End 51.33 ms 298.78 ms +482.0%
Clear 63.59 ms 307.65 ms +383.8%
Move Construct 13.63 ms 38.59 ms +183.2%
Growth Reallocation 145.45 ms 386.37 ms +165.6%
Erase Middle 68.23 ms 175.62 ms +157.4%
Erase Front 76.85 ms 186.80 ms +143.1%
Move Assignment 16.63 ms 38.56 ms +131.9%
Insert End 118.56 ms 230.92 ms +94.8%
Front/Back Access 300.87 us 508.17 us +68.9%
Reserve No-op (10K) 5.55 us 2.75 us -50.4%
Erase-Remove If 1.31 s 775.74 ms -40.8%

VectorPro's largest wins show up on removal and reallocation-heavy workloads
at the 1M scale — pop_back(), erase() (front/middle/end), clear(), and
growCapacity()-driven reallocation all pull well ahead of std::vector as
element count grows, and the same holds for move construction and move
assignment.

The trade-offs are concentrated in two spots: remove_if()'s compaction loop
runs behind std::vector's erase-remove idiom at every scale tested, and
reserve()'s no-op check carries a small fixed branch overhead that only
shows up at the smallest (10K) iteration count. Most other operations —
element access, iteration, search, construction, comparison — track
std::vector within a few percent in either direction.

Testing

The project includes a comprehensive test suite covering:

  • Unit tests
  • Integration tests
  • Lifecycle tests
  • Regression tests
  • Concurrency tests
  • Move semantics
  • Copy/move allocator propagation
  • Growth policy and reallocation behavior
  • Iterator conformance (std::contiguous_iterator)
  • Insert/erase aliasing (self-referencing values)
  • remove_if() compaction correctness
  • Event notification (subscribe()/unsubscribe()) behavior
  • Comparison operators (==, <=>)
  • Exception safety and strong-guarantee paths

Code Coverage

The current test suite achieves:

  • 95.7% line coverage (462 / 483 lines)
  • 99.6% function coverage (233 / 234 functions)

Coverage figures exclude test infrastructure, focusing on the VectorPro
library implementation.

Continuous Integration

Automated builds and tests are configured for:

  • GCC — Debug
  • GCC — Release
  • Clang — Debug
  • Clang — Release
  • MSVC — Debug
  • MSVC — Release
  • AppleClang — Debug
  • AppleClang — Release

Release

This release represents the first stable version of VectorPro and establishes
the initial API, growth-policy and allocator design, iterator model, optional
event-notification system, testing infrastructure, and cross-platform CI
pipeline.

Installation

Clone the repository and integrate VectorPro into your C++20 project using the
provided CMake configuration.

See the project documentation for build instructions, API usage, and
integration details.