Skip to content

Implement Virtual Fields for Zero-Overhead Records #9193

@tobiu

Description

@tobiu

Objective

Implement virtual: true support in Neo.data.RecordFactory and update DevIndex.model.Contributor to utilize it.

Motivation

The DevIndex.model.Contributor currently generates 60+ fields for yearly stats (e.g., y2020, cy2020). Despite claims of "Zero Overhead", these are currently stored as individual properties on every record instance, causing significant memory duplication.

Implementation Plan

  1. Update Neo.data.RecordFactory:
    • Support virtual: true in field configs.
    • Getter Logic: Virtual fields will define a getter on the prototype that executes field.calculate(this[dataSymbol]).
    • Storage Logic: assignDefaultValues and setRecordFields must skip virtual fields to ensure they are never written to the instance data.
  2. Update DevIndex.model.Contributor:
    • Update addYearFields to set virtual: true for all year-based fields (y..., cy..., py...).
    • Ensure the calculate functions for these fields use efficient O(1) array lookups.

Outcome

True "Zero Overhead" for calculated year fields, reducing memory footprint for the 50k+ contributor dataset while maintaining O(1) access performance.

Metadata

Metadata

Assignees

Labels

aicoreCore framework functionalityenhancementNew feature or requestperformancePerformance improvements and optimizations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions