Files
test2/source/blender/depsgraph/intern/node/deg_node_factory.hh
Hans Goudey 83325d1fd3 Refactor: Depsgraph: Use StringRef, inline some simple methods
While profiling a scene with many objects, I noticed some unexpected
functions taking a significant time of depsgraph creation/evaluation.
String length calculation and equality comparison was taking longer than
it should, and some simple methods were appearing in profiles that should
be inlined instead.

There are more places where this sort of change would be helpful, this
commit just changes places using `OperationIDKey` and `ComponentIDKey`.

Pull Request: https://projects.blender.org/blender/blender/pulls/136795
2025-04-01 17:30:39 +02:00

45 lines
1.0 KiB
C++

/* SPDX-FileCopyrightText: 2019 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup depsgraph
*/
#pragma once
#include "BLI_string_ref.hh"
#include "intern/node/deg_node.hh"
struct ID;
namespace blender::deg {
struct DepsNodeFactory {
virtual NodeType type() const = 0;
virtual const char *type_name() const = 0;
virtual int id_recalc_tag() const = 0;
virtual Node *create_node(const ID *id, const char *subdata, StringRef name) const = 0;
};
template<class ModeObjectType> struct DepsNodeFactoryImpl : public DepsNodeFactory {
NodeType type() const override;
const char *type_name() const override;
int id_recalc_tag() const override;
Node *create_node(const ID *id, const char *subdata, StringRef name) const override;
};
/* Register typeinfo */
void register_node_typeinfo(DepsNodeFactory *factory);
/* Get typeinfo for specified type */
DepsNodeFactory *type_get_factory(NodeType type);
} // namespace blender::deg
#include "intern/node/deg_node_factory_impl.hh"