Create a Fact class for storing facts
Today, the congress runtime stores facts as Rules. This is inefficient from a memory perspective since each Rule contains a Literal, which in turn contains a Term for each column. Each of these is a python object, and each of them also contains a few extra fields like head, body, location, negated, etc. Using Rules is also inefficient with CPU since congress needs to construct all these objects. This blueprint proposes to use a Fact data structure to store each fact. A Fact is a subclass of a native tuple, plus one field for table name. This is much more efficient memorywise and CPUwise than using a Rule because there are no extra objects like Literal and Term. Preliminary tests show a 10x reduction in CPU for initializing tables plus a 3x reduction in memory use.
Blueprint information
- Status:
- Complete
- Approver:
- Tim Hinrichs
- Priority:
- High
- Drafter:
- Alexander Yip
- Direction:
- Approved
- Assignee:
- Alexander Yip
- Definition:
- Approved
- Series goal:
- None
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- Tim Hinrichs
- Completed by
- Tim Hinrichs
Related branches
Related bugs
Sprints
Whiteboard
Addressed by: https:/
Add and use Fact and FactSet
Gerrit topic: https:/