Skip to content

Commit cf9e899

Browse files
committed
use string_view for getFieldIndexForClass
1 parent d198df5 commit cf9e899

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

loader/src/hooks/GeodeNodeMetadata.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ struct ProxyCCNode : Modify<ProxyCCNode, CCNode> {
122122
}
123123
};
124124

125-
static inline std::unordered_map<std::string, size_t> s_nextIndex;
125+
// it is mostly safe to use string_view here to reduce heap allocations,
126+
// since passed names are obtained by typed().name() which is static
127+
static inline std::unordered_map<std::string_view, size_t> s_nextIndex;
126128
size_t modifier::getFieldIndexForClass(char const* name) {
127129
return s_nextIndex[name]++;
128130
}

0 commit comments

Comments
 (0)