Skip to content

Performance: Optimize Collection items_ config to use shallow cloning #9334

@tobiu

Description

@tobiu

Problem

The items_ config in Neo.collection.Base was defaulting to clone: 'deep' (the default for reactive configs in Neo.mjs). For large datasets (e.g., 50,000 records in the DevIndex app), setting or initializing items_ triggered a deep clone of the entire array and every single record object within it. This caused a massive performance bottleneck, specifically an ~800ms delay when the allItems collection was created during the first filter operation.

Solution

Updated the items_ config to use a descriptor with clone: 'shallow'. This ensures that only the array structure itself is copied (preserving immutability for the collection array) while the individual record objects maintain their exact references. This drops the items assignment overhead for 50k records from ~779ms down to ~6ms, eliminating the bottleneck while ensuring updates to records propagate correctly between filtered and unfiltered states.

Metadata

Metadata

Assignees

Labels

aienhancementNew 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