Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upOptimize entities #227
Optimize entities #227
Comments
|
|
|
Just want to continue dumping my thoughts: I ended up implementing this for my datascript fork (which adds a few other features) in a slightly different way: Instead of bounded counting an So
For the majority of Entities, this means we only once search the btset and get all the attributes in the cache quickly. For entities with many attributes this is still fast since we're still at near-constant time here. |
Also partially dicussed on Slack:
Currently an attribute lookup on an entity does a search into the btset and then caches the result. This is inefficient since the all the attribute values are right next to each other in the
eavtindex.Getting them all at once and storing them in a cache makes sense, but has huge problem:
I think 2) is unlikely a use-case and can be ignored. However 1) is an issue.
Ideas:
Iterinstance that represents(Datom. eid nil nil nil nil), ie, all Datoms belonging to an entity. This is fast to get.Iterto allow fast searching within anIter. This would mean we can avoid thecacheof an entity and just lookup in theIter.countof anIteris "too large" (> 20??). For this implementbounded-countforIter. See #226