You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we use virtual std::string serialize() = 0; in Expression interface. The serialize which returns a string is concise, but it's inefficient for a tree-style data structure. e.g. If our tree has 10 level and 30 nodes, we have to do at least 30 buffer allocations.
Describe the solution you'd like (if any)
Maybe we can pass a std::stringstream in the serialize, or some other custom appended, e.g.:
voidvirtualserialize(std::stringstream&);
We can use less allocations to improve the performance, e.g., for GlobalPtrExpression:
voidGlobalPtrExpression::serialize(std::stringstream& builder) {
builder << snode ? snode->get_node_type_name_hinted() : var.serialize();
builder << '[';
for (int i = 0; i < (int)indices.size(); i++) {
indices.exprs[i]->serialize(builder);
if (i + 1 < (int)indices.size())
builder << ', ';
}
builder << ']';
}
Additional comments
The text was updated successfully, but these errors were encountered:
Concisely describe the proposed feature
Currently, we use
virtual std::string serialize() = 0;
inExpression
interface. Theserialize
which returns astring
is concise, but it's inefficient for a tree-style data structure. e.g. If our tree has 10 level and 30 nodes, we have to do at least 30 buffer allocations.Describe the solution you'd like (if any)
Maybe we can pass a
std::stringstream
in theserialize
, or some other custom appended, e.g.:We can use less allocations to improve the performance, e.g., for
GlobalPtrExpression
:Additional comments
The text was updated successfully, but these errors were encountered: