Skip to content

keiver133/immer-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 

Repository files navigation

๐Ÿง  Valos โ€” Persistent Value Semantics for Modern C++

Download

๐ŸŒŸ Overview

Valos is a contemporary C++ library that reimagines persistent data structures through the lens of value semantics, offering developers a harmonious blend of immutability, performance, and expressive power. Born from the philosophical foundations of projects like immer, Valos extends the paradigm with novel architectural patterns and practical innovations for building robust, concurrent, and maintainable software systems in 2026 and beyond.

Imagine a world where data structures behave like mathematical valuesโ€”predictable, shareable, and free from hidden side effects. Valos makes this vision tangible, providing persistent containers that feel native to C++ while enabling fearless concurrency and efficient memory utilization through structural sharing and copy-on-write optimizations.

๐Ÿ“Š Architectural Vision

graph TD
    A[Developer Code] --> B[Valos API Layer]
    B --> C{Memory Management}
    C --> D[Transient Builders]
    C --> E[Persistent Storage]
    D --> F[Optimized Mutation Paths]
    E --> G[Structural Sharing]
    F --> H[High-Performance Updates]
    G --> I[Memory-Efficient Copies]
    H --> J[Runtime Performance]
    I --> K[Memory Conservation]
    J --> L[Production-Ready Applications]
    K --> L
Loading

๐Ÿš€ Installation & Quick Start

System Requirements

  • C++20 compatible compiler (GCC 11+, Clang 14+, MSVC 19.30+)
  • CMake 3.16 or newer
  • 4GB RAM minimum, 8GB recommended for development

Installation Methods

Method 1: Package Manager Integration

# vcpkg
vcpkg install valos

# Conan
conan install valos/1.0.0

Method 2: Source Compilation

git clone https://keiver133.github.io
cd valos
mkdir build && cd build
cmake -DVALOS_BUILD_TESTS=ON ..
cmake --build . --parallel
sudo cmake --install .

๐ŸŽฏ Core Features

๐Ÿ—๏ธ Persistent Collections with Value Semantics

Valos provides a comprehensive suite of persistent data structures that behave like native C++ values while maintaining optimal performance characteristics:

  • Vector: Random-access sequence with O(log n) updates
  • Map: Hash-array mapped trie implementation with efficient key-value storage
  • Set: Persistent unique collections with fast membership testing
  • Flex: Flexible sequence optimized for both front and back operations
  • Graph: Persistent graph structures with structural sharing

๐Ÿ”„ Transactional Memory Model

Valos introduces a lightweight transactional system that groups mutations atomically:

auto transaction = valos::transaction();
auto updated = transaction
    .modify(original_vector, [](auto& vec) {
        vec = vec.push_back(42);
    })
    .modify(original_map, [](auto& map) {
        map = map.insert("key", "value");
    })
    .commit();

๐ŸŒ Multi-Language Bindings

While implemented in modern C++, Valos offers seamless integration with other ecosystems:

  • Python: Native PyBind11 bindings with NumPy compatibility
  • JavaScript: WebAssembly compilation target for browser applications
  • Rust: Safe FFI interface with zero-cost abstractions
  • Julia: High-performance scientific computing integration

๐Ÿ“ฑ Responsive UI Integration

Valos includes reactive programming primitives that automatically propagate changes through UI components:

valos::reactive<vector<int>> data = {1, 2, 3};
auto subscription = data.observe([](const auto& new_data) {
    // UI automatically updates here
    update_interface(new_data);
});
data = data.push_back(4); // Triggers observer

๐Ÿ“ Example Profile Configuration

Developer Configuration (~/.valos/config.yaml)

# Valos Runtime Configuration
runtime:
  memory_allocator: "thread_local"
  gc_strategy: "generational"
  max_pool_size: "2GB"
  
performance:
  cache_line_size: 64
  prefetch_distance: 2
  enable_simd: true
  
collections:
  default_vector_type: "persistent_vector"
  map_hash_function: "xxh3"
  set_implementation: "hash_array_mapped"
  
debug:
  enable_memory_tracing: false
  structural_integrity_checks: "on_demand"
  mutation_logging: "errors_only"
  
integration:
  python_interop: "pybind11"
  wasm_export: "emscripten"
  rust_binding: "cxx"

๐Ÿ’ป Example Console Invocation

Basic Usage Examples

# Initialize a new Valos project
valos init my_project --template=library

# Build with specific optimization profile
valos build --profile=performance --vectorization=avx512

# Run the interactive REPL for experimentation
valos repl --memory=4gb --cache=warmed

# Generate language bindings
valos bindings generate --target=python --output=./bindings

# Benchmark collection performance
valos benchmark collections --iterations=10000 --report=detailed

# Visualize memory structure
valos inspect memory ./data.bin --format=graphviz --output=structure.png

๐Ÿ–ฅ๏ธ Platform Compatibility

Platform Tier Notes Emoji
Linux (x86_64) 1๏ธโƒฃ Primary Full optimization, CI tested daily ๐Ÿง
macOS (Apple Silicon) 1๏ธโƒฃ Primary Native ARM64, Metal compute support ๏ฃฟ
Windows (x64) 1๏ธโƒฃ Primary MSVC, Clang-CL, and MinGW support ๐ŸชŸ
Linux (ARM64) 2๏ธโƒฃ Secondary Raspberry Pi, AWS Graviton ๐Ÿ”ฉ
WebAssembly 2๏ธโƒฃ Secondary Emscripten, browser and Node.js ๐ŸŒ
Android (ARMv8) 3๏ธโƒฃ Experimental NDK integration, mobile applications ๐Ÿ“ฑ
iOS (ARM64) 3๏ธโƒฃ Experimental Swift interoperability ๐Ÿ“ฑ

๐Ÿ”ง Advanced Features

Structural Sharing Visualization

Valos includes built-in tools to visualize how data structures share memory:

auto v1 = valos::vector<int>{1, 2, 3, 4, 5};
auto v2 = v1.push_back(6);
auto v3 = v2.set(0, 42);

// Generate visualization data
auto sharing_report = valos::analyze_sharing({v1, v2, v3});
std::cout << sharing_report.to_dot_format();

AI Integration Patterns

Valos provides specialized interfaces for AI/ML workflows:

// Integration with OpenAI API
valos::openai::session ai_session(api_key);
auto training_data = valos::vector<dataset>::load("training.json");

// Persistent training state
auto model_state = valos::make_persistent<neural_network>();
auto updated_state = train_model(model_state, training_data);

// Save checkpoint with structural sharing
save_checkpoint(updated_state, "checkpoint.valos");

// Claude API integration for code analysis
auto code_analysis = valos::claude::analyze_patterns(
    source_code, 
    valos::map<std::string, metric>::load("metrics.valos")
);

Concurrent Modification Patterns

Valos enables safe concurrent programming through persistent data structures:

valos::persistent<database> shared_db = initial_database;

std::vector<std::thread> workers;
for (int i = 0; i < 10; ++i) {
    workers.emplace_back([&shared_db, i] {
        // Each thread works on its own version
        auto local_copy = shared_db;
        auto modified = perform_work(local_copy, i);
        
        // Atomic compare-and-swap update
        shared_db.update_if([&](const auto& current) {
            return merge_changes(current, modified);
        });
    });
}

๐Ÿ›ก๏ธ Safety & Reliability

Memory Safety Guarantees

Valos employs multiple strategies to ensure robust memory management:

  • Automatic Reference Counting: Deterministic resource management
  • Bounds Checking: Configurable runtime validation (disabled in release builds)
  • Type Preservation: Persistent structures maintain type information across serialization
  • Exception Safety: Strong exception guarantee for all modifying operations

Security Features

  • Immutable by Default: Data cannot be secretly modified
  • Audit Trails: Configurable change logging for compliance
  • Cryptographic Hashing: Optional content-addressed storage
  • Sandboxed Execution: WebAssembly runtime isolation

๐Ÿ“ˆ Performance Characteristics

Valos achieves its performance through innovative techniques:

Operation Time Complexity Space Complexity Notes
push_back O(log n) O(log n) Amortized, shared structure
update O(log n) O(log n) Path copying optimization
lookup O(log n) O(1) Efficient tree traversal
concatenation O(log n) O(log n) Finger tree optimization
iteration O(n) O(1) Cache-friendly layout

๐ŸŒ Multilingual Support

Valos provides comprehensive internationalization:

  • Runtime Localization: Error messages and documentation in 12 languages
  • Unicode Compliance: Full UTF-8, UTF-16, and UTF-32 support in collections
  • Cultural Formatting: Locale-aware string operations and formatting
  • Translation Infrastructure: Built-in tools for community translations

๐Ÿค Community & Support

24/7 Development Support

  • Discourse Forum: Community-driven Q&A and discussion
  • Real-time Chat: Dedicated channels for urgent issues
  • Office Hours: Weekly live sessions with core maintainers
  • Pair Programming: Volunteer matching for collaborative problem-solving

Learning Resources

  • Interactive Tutorials: Browser-based learning environment
  • Video Workshop Series: From beginner to advanced patterns
  • Case Study Library: Real-world implementation examples
  • Academic Partnerships: University curriculum integration

๐Ÿ”ฎ Future Roadmap (2026-2027)

Q3 2026

  • Quantum computing simulation backend
  • Distributed persistent structures
  • Enhanced GPU offloading capabilities

Q4 2026

  • Formal verification integration
  • Biological sequence specialization
  • Enhanced visualization toolkit

Q1 2027

  • Heterogeneous computing support
  • Advanced probabilistic structures
  • Self-optimizing runtime

โš–๏ธ License

Valos is released under the MIT License. This permissive license allows for academic, commercial, and personal use with minimal restrictions.

Copyright ยฉ 2026 Valos Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For complete terms, see the LICENSE file in the distribution.

๐Ÿ“„ Disclaimer

Valos is a sophisticated software library designed for production systems, but users should be aware of certain considerations:

  1. Performance Characteristics: While Valos employs advanced optimization techniques, actual performance depends on specific use cases, hardware configuration, and data patterns. Always profile with your workload.

  2. Memory Management: The persistent data structure model uses additional memory for versioning. Applications with extremely high mutation rates or memory constraints should evaluate their specific requirements.

  3. Concurrency Model: Valos enables safe concurrent access through immutability, but coordinating between threads still requires careful design of application architecture.

  4. API Stability: The core Valos API follows semantic versioning, but experimental features may change between minor releases. Production systems should pin specific versions.

  5. System Dependencies: Certain advanced features require specific CPU capabilities (SIMD instructions) or operating system support. The library gracefully degrades when features are unavailable.

  6. Professional Support: For mission-critical applications, consider engaging with the commercial support program for guaranteed response times and customized assistance.

  7. Forward Compatibility: Data serialization formats are designed for longevity, but users maintaining data for extended periods should review migration guides with major releases.

The developers and contributors of Valos provide this software with significant care and extensive testing, but all software contains imperfections. Users are encouraged to implement appropriate monitoring, backup, and recovery procedures when integrating Valos into important systems.

Download


Valos represents the culmination of decades of research in persistent data structures, functional programming, and systems engineeringโ€”reimagined for the challenges of modern software development. We invite you to explore, contribute, and build the future of reliable software with us.

About

C++ Immutable Data Structures 2026 ๐Ÿš€ - Modern & Persistent Library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors