Depsgraph: Switch away form string to const char* for node names
There is no real reason to have nodes storing heap-allocated name and description. Doing this increases amount of allocations during dependency graph building, which usually means somewhat slowness. We're temporarily loosing some eyecandy in the graphviz visualizer, but those we can bring back as a part of graphiz dump (which happens much less often than depsgraph build). This will happen in multiple commits for the ease of bisect in the future just in case this causes any regression. This commit contains ID creation API changes.
This commit is contained in:
parent
fe53bdf893
commit
f7f44da43d
|
@ -131,8 +131,7 @@ RootDepsNode *DepsgraphNodeBuilder::add_root_node()
|
|||
|
||||
IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
|
||||
{
|
||||
const char *idtype_name = BKE_idcode_to_name(GS(id->name));
|
||||
return m_graph->add_id_node(id, string(id->name + 2) + "[" + idtype_name + "]");
|
||||
return m_graph->add_id_node(id, id->name);
|
||||
}
|
||||
|
||||
TimeSourceDepsNode *DepsgraphNodeBuilder::add_time_source(ID *id)
|
||||
|
|
|
@ -328,7 +328,7 @@ IDDepsNode *Depsgraph::find_id_node(const ID *id) const
|
|||
return reinterpret_cast<IDDepsNode *>(BLI_ghash_lookup(id_hash, id));
|
||||
}
|
||||
|
||||
IDDepsNode *Depsgraph::add_id_node(ID *id, const string &name)
|
||||
IDDepsNode *Depsgraph::add_id_node(ID *id, const char *name)
|
||||
{
|
||||
IDDepsNode *id_node = find_id_node(id);
|
||||
if (!id_node) {
|
||||
|
|
|
@ -120,7 +120,7 @@ struct Depsgraph {
|
|||
void clear_subgraph_nodes();
|
||||
|
||||
IDDepsNode *find_id_node(const ID *id) const;
|
||||
IDDepsNode *add_id_node(ID *id, const string &name = "");
|
||||
IDDepsNode *add_id_node(ID *id, const char *name = "");
|
||||
void remove_id_node(const ID *id);
|
||||
void clear_id_nodes();
|
||||
|
||||
|
|
Loading…
Reference in New Issue