Skip to content

Improve performance of getting single values - store.get_value #402

Open
@joepio

Description

@joepio

Currently, the Db stores entire resources in big HashMap resources. This works fine, mostly, but I think we can do better.

Say we store Values instead of resources. We structure keys like this: subject + property. We can then fetch individual properties for resources without having to deserialize the entire resource. That should definitely speed things up. Especially when a resource has a particularly large ResourceArray, or large nested Resources, while we only want one short value.

For example, the check_rights function recursively checks parents for their write rights. This can become costly when there are parents with many properties. The store will have to deserialize the entire resource every time.

So, how to approach this?

  • Add a create_value_key function, which takes one Atom and converts it into a single KV pair
  • Perhaps we also need to convert large ResourceArrays into larger KV pairs
  • Rewrite the get_propvals function
  • Add a get_value function to Storelike, which takes a path as an argument (a string? A vec of strings?). Or perhaps a subject and a path.
  • Find costly functions (such as check_rights) and use the store.get_value function there.
  • Benchmark it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions