@@ -97,7 +97,7 @@ MetadataNode* MetadataNode::GetOrCreate(const string& className) {
9797
9898 node = GetOrCreateInternal (treeNode);
9999
100- s_name2NodeCache.insert ( make_pair ( className, node) );
100+ s_name2NodeCache.emplace ( className, node);
101101 } else {
102102 node = it->second ;
103103 }
@@ -115,7 +115,7 @@ MetadataNode* MetadataNode::GetOrCreateInternal(MetadataTreeNode* treeNode) {
115115 } else {
116116 result = new MetadataNode (treeNode);
117117
118- s_treeNode2NodeCache.insert ( make_pair ( treeNode, result) );
118+ s_treeNode2NodeCache.emplace ( treeNode, result);
119119 }
120120
121121 return result;
@@ -131,7 +131,7 @@ MetadataTreeNode* MetadataNode::GetOrCreateTreeNodeByName(const string& classNam
131131 } else {
132132 result = s_metadataReader.GetOrCreateTreeNodeByName (className);
133133
134- s_name2TreeNodeCache.insert ( make_pair ( className, result) );
134+ s_name2TreeNodeCache.emplace ( className, result);
135135 }
136136
137137 return result;
@@ -993,7 +993,7 @@ Local<FunctionTemplate> MetadataNode::GetConstructorFunctionTemplate(Isolate* is
993993 ctorFuncTemplate.Clear ();
994994 auto pft = new Persistent<FunctionTemplate>(isolate, ctorFuncTemplate);
995995 CtorCacheData ctorCacheItem (pft, instanceMethodsCallbackData);
996- cache->CtorFuncCache .insert ( make_pair ( treeNode, ctorCacheItem) );
996+ cache->CtorFuncCache .emplace ( treeNode, ctorCacheItem);
997997 return ctorFuncTemplate;
998998 }
999999
@@ -1060,7 +1060,7 @@ Local<FunctionTemplate> MetadataNode::GetConstructorFunctionTemplate(Isolate* is
10601060 // cache "ctorFuncTemplate"
10611061 auto pft = new Persistent<FunctionTemplate>(isolate, ctorFuncTemplate);
10621062 CtorCacheData ctorCacheItem (pft, instanceMethodsCallbackData);
1063- cache->CtorFuncCache .insert ( make_pair ( treeNode, ctorCacheItem) );
1063+ cache->CtorFuncCache .emplace ( treeNode, ctorCacheItem);
10641064
10651065 SetInnerTypes (isolate, wrappedCtorFunc, treeNode);
10661066
@@ -1735,11 +1735,11 @@ void MetadataNode::ExtendMethodCallback(const v8::FunctionCallbackInfo<v8::Value
17351735 SetTypeMetadata (isolate, extendFunc, new TypeMetadata (fullExtendedName));
17361736 info.GetReturnValue ().Set (extendFunc);
17371737
1738- s_name2NodeCache.insert ( make_pair ( fullExtendedName, node) );
1738+ s_name2NodeCache.emplace ( fullExtendedName, node);
17391739
17401740 ExtendedClassCacheData cacheData (extendFunc, fullExtendedName, node);
17411741 auto cache = GetMetadataNodeCache (isolate);
1742- cache->ExtendedCtorFuncCache .insert ( make_pair ( fullExtendedName, cacheData) );
1742+ cache->ExtendedCtorFuncCache .emplace ( fullExtendedName, cacheData);
17431743
17441744 if (frame.check ()) {
17451745 frame.log (" Extending: " + node->m_name );
@@ -2027,7 +2027,7 @@ MetadataNode::MetadataNodeCache* MetadataNode::GetMetadataNodeCache(Isolate* iso
20272027 auto itFound = s_metadata_node_cache.find (isolate);
20282028 if (itFound == s_metadata_node_cache.end ()) {
20292029 cache = new MetadataNodeCache;
2030- s_metadata_node_cache.insert ( make_pair ( isolate, cache) );
2030+ s_metadata_node_cache.emplace ( isolate, cache);
20312031 } else {
20322032 cache = itFound->second ;
20332033 }
@@ -2293,10 +2293,10 @@ void MetadataNode::onDisposeIsolate(Isolate* isolate) {
22932293
22942294string MetadataNode::TNS_PREFIX = " com/tns/gen/" ;
22952295MetadataReader MetadataNode::s_metadataReader;
2296- std::map <std::string, MetadataNode*> MetadataNode::s_name2NodeCache;
2297- std::map <std::string, MetadataTreeNode*> MetadataNode::s_name2TreeNodeCache;
2298- std::map <MetadataTreeNode*, MetadataNode*> MetadataNode::s_treeNode2NodeCache;
2299- map <Isolate*, MetadataNode::MetadataNodeCache*> MetadataNode::s_metadata_node_cache;
2296+ robin_hood::unordered_map <std::string, MetadataNode*> MetadataNode::s_name2NodeCache;
2297+ robin_hood::unordered_map <std::string, MetadataTreeNode*> MetadataNode::s_name2TreeNodeCache;
2298+ robin_hood::unordered_map <MetadataTreeNode*, MetadataNode*> MetadataNode::s_treeNode2NodeCache;
2299+ robin_hood::unordered_map <Isolate*, MetadataNode::MetadataNodeCache*> MetadataNode::s_metadata_node_cache;
23002300bool MetadataNode::s_profilerEnabled = false ;
2301- std::map <Isolate*, Persistent<ObjectTemplate>*> MetadataNode::s_arrayObjectTemplates;
2301+ robin_hood::unordered_map <Isolate*, Persistent<ObjectTemplate>*> MetadataNode::s_arrayObjectTemplates;
23022302
0 commit comments