Skip to content

PERFORMANCE FIX: TableCacheImpl TODO: this just scans the whole table; we should build proper index structures #5317

@sephirith

Description

@sephirith

It shows up in all my performance profiling as an issue. Specifically, the todo comment you guys have in there. Please prioritise, it is showing up in all my performance profiles.

crates/bindings-typescript/src/sdk/table_cache.ts

Class: TableCacheImpl
Method: #makeReadonlyIndex (private), around line 105
TODO: // TODO: this just scans the whole table; we should build proper index structures
Hot path: find() on unique indexes loops self.iter() and calls deepEqual(getKey(row), expected) per row (lines ~198–204)
filter() on ranged indexes does the same scan + deepEqual in matchRange
crates/bindings-typescript/src/lib/util.ts

Function: deepEqual (lines ~9–37)
Uses Object.keys() twice + recursive comparison

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions