Summary
Frame implementation, and backend interface revamping.
Motivation
Current frame implementation uses node and attribute name tuple as key to query attribute, then use it to access value, this is slow as it will create a tuple object every time we access an attribute.
Description
- Revamp frame internal implementation to use int instead of string to get/set/query attributes, then we use this as unique key for quick accessing.
- Based on 1st option, we need to revamp backend interfaces to support return an ID for new added node and attribute, then access this ID to access value.
- Since we are going to use c++ to implement raw backend, we also need to upgrade current np backend and frame layer to use c++ compiler. Ideally we only need replace "class" with "cppclass" at cython part.
Above changes would not affect current frame interfaces for python side.
References
# backend layer
cdef cppclass backend:
IDENTIFIER add_node(str name, UINT number)
IDENTIFIER add_attr(IDENTIFIER node_id, str name, str dtype, UINT slots)
object get_attr_value(IDENTIFIER id, UINT slot_index)
object set_attr_value(IDENTIFIER id, UINT slot_index, object value)
# frame layer
node1_id = backend.add_node("node1", 10)
node2_id = backend.add_node("node2", 5)
attr1_id = backend.add_attr(node1_id, "a1", "i", 2)
attr2_id = backend.add_attr(node1_id, "a2", "i", 3)
val = backend.get_attr_value(attr1_id, 1, 1)
backend.set_attr_value(attr1_id, 0, 12)
Alternatives
No
Additional context
No
Summary
Frame implementation, and backend interface revamping.
Motivation
Current frame implementation uses node and attribute name tuple as key to query attribute, then use it to access value, this is slow as it will create a tuple object every time we access an attribute.
Description
Above changes would not affect current frame interfaces for python side.
References
Alternatives
No
Additional context
No