Open
Description
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 toStorelike
, which takes apath
as an argument (a string? Avec
of strings?). Or perhaps asubject
and apath
. - Find costly functions (such as
check_rights
) and use thestore.get_value
function there. - Benchmark it!