Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add note about use of BaseModel.construct
The previous version used by the direct() methods would be something like: def model_construct(cls, _fields_set: set[str] | None = None, **values: Any) -> Self: node = cls.__new__(cls) setter = object.__setattr__ for k, v in values.items(): setter(node, k, v) if _fields_set is None: _fields_set = set(values.keys()) setter(node, "__fields_set__", _fields_set) return node Testing with 100MB graph indicates that construct() might be fractionally slower than implementing it ourselves as above but it is not conclusive. The direct() method only accounts for 14% of the graph load time.
- Loading branch information