[commit] r1297 - trunk/GME/Core
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Mon May 9 11:46:02 CDT 2011
Author: ksmyth
Date: Mon May 9 11:46:01 2011
New Revision: 1297
Log:
2 fewer vtable pointers for core attributes. core attributes can be as much as 1/3 memory usage in a large tx, e.g. copying a folder
Modified:
trunk/GME/Core/CoreAttribute.h
trunk/GME/Core/CoreTransactionItem.h
trunk/GME/Core/StdAfx.cpp
trunk/GME/Core/StdAfx.h
Modified: trunk/GME/Core/CoreAttribute.h
==============================================================================
--- trunk/GME/Core/CoreAttribute.h Fri Apr 29 10:58:44 2011 (r1296)
+++ trunk/GME/Core/CoreAttribute.h Mon May 9 11:46:01 2011 (r1297)
@@ -2,6 +2,8 @@
#ifndef MGA_COREATTRIBUTE_H
#define MGA_COREATTRIBUTE_H
+#include "StdAfx.h"
+
#ifndef MGA_CORETRANSACTIONITEM_H
#include "CoreTransactionItem.h"
#endif
@@ -24,12 +26,20 @@
class CCoreTerritory;
class CCoreMetaAttribute;
+class CCoreAttributeErrorTearOff :
+ public ISupportErrorInfoImpl<&IID_ICoreAttribute>,
+ public CComTearOffObjectBase<CCoreAttribute>
+{
+BEGIN_COM_MAP(CCoreAttributeErrorTearOff)
+ COM_INTERFACE_ENTRY(ISupportErrorInfo)
+END_COM_MAP()
+};
+
// --------------------------- CCoreAttribute
class ATL_NO_VTABLE CCoreAttribute :
public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<ICoreAttribute, &IID_ICoreAttribute, &LIBID_MGACoreLib>,
- public ISupportErrorInfoImpl<&IID_ICoreAttribute>
+ public IDispatchImpl<ICoreAttribute, &IID_ICoreAttribute, &LIBID_MGACoreLib>
{
public:
CCoreAttribute();
@@ -46,7 +56,7 @@
BEGIN_COM_MAP(CCoreAttribute)
COM_INTERFACE_ENTRY(ICoreAttribute)
COM_INTERFACE_ENTRY(IDispatch)
- COM_INTERFACE_ENTRY(ISupportErrorInfo)
+ COM_INTERFACE_ENTRY_TEAR_OFF(IID_ISupportErrorInfo, CCoreAttributeErrorTearOff)
END_COM_MAP()
// ------- COM methods
@@ -225,7 +235,7 @@
public:
typedef DATA value_type;
- typedef std::list<value_type> values_type;
+ typedef core::list<value_type> values_type;
typedef typename values_type::iterator values_iterator;
protected:
@@ -294,7 +304,7 @@
public:
typedef CComObjPtr<CCoreCollectionAttribute> value_type;
- typedef std::list<value_type> values_type;
+ typedef core::list<value_type> values_type;
typedef values_type::iterator values_iterator;
typedef std::set< CCoreObject*, ptr_compare<CCoreObject> > objects_type;
@@ -362,7 +372,7 @@
template<class BASE, const int VALTYPE>
class ATL_NO_VTABLE CCoreDataAttribute :
public /*typename*/ BASE,//z!
- public CCoreTransactionItem,
+ // public CCoreTransactionItem,
public CCoreUndoItem
{
public:
Modified: trunk/GME/Core/CoreTransactionItem.h
==============================================================================
--- trunk/GME/Core/CoreTransactionItem.h Fri Apr 29 10:58:44 2011 (r1296)
+++ trunk/GME/Core/CoreTransactionItem.h Mon May 9 11:46:01 2011 (r1297)
@@ -53,7 +53,9 @@
// call CCoreProject::RegisterUndoItem to register,
// call it only from CommitFinalTransactionFinish
-class ATL_NO_VTABLE CCoreUndoItem
+class ATL_NO_VTABLE CCoreUndoItem : public CCoreTransactionItem
+ // KMS: inherit from CCoreTransactionItem so one less vtable pointer is required in subclasses
+ // (the only subclass is CCoreDataAttribute which also implements CCoreTransactionItem)
{
public:
// do the work here, called only once for each level
Modified: trunk/GME/Core/StdAfx.cpp
==============================================================================
--- trunk/GME/Core/StdAfx.cpp Fri Apr 29 10:58:44 2011 (r1296)
+++ trunk/GME/Core/StdAfx.cpp Mon May 9 11:46:01 2011 (r1297)
@@ -8,3 +8,33 @@
#include <statreg.h>
#endif
+/*
+// EASTL impl
+void* operator new[](size_t size, const char* pName, int flags,
+ unsigned debugFlags, const char* file, int line)
+{
+ return malloc(size);
+}
+void* operator new[](size_t size, size_t alignment, size_t alignmentOffset,
+ const char* pName, int flags, unsigned debugFlags, const char* file, int line)
+{
+ // doesn't support alignment
+ return malloc(size);
+}
+
+int Vsnprintf8(char8_t* pDestination, size_t n, const char8_t* pFormat, va_list arguments)
+{
+ #ifdef _MSC_VER
+ return _vsnprintf(pDestination, n, pFormat, arguments);
+ #else
+ return vsnprintf(pDestination, n, pFormat, arguments);
+ #endif
+}
+
+#include "allocator.cpp"
+#include "assert.cpp"
+#include "fixed_pool.cpp"
+#include "hashtable.cpp"
+#include "string.cpp"
+*/
+
Modified: trunk/GME/Core/StdAfx.h
==============================================================================
--- trunk/GME/Core/StdAfx.h Fri Apr 29 10:58:44 2011 (r1296)
+++ trunk/GME/Core/StdAfx.h Mon May 9 11:46:01 2011 (r1297)
@@ -15,6 +15,25 @@
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
+#define EA_CHAR16_NATIVE 1
+//#include "EASTL/list.h"
+//#include "EASTL/hash_map.h"
+//#include "EASTL/hash_set.h"
+
+#include "hash_set"
+#include "hash_map"
+
+namespace core {
+// using eastl::hash_map;
+// using eastl::hash_set;
+// using eastl::pair;
+// using eastl::list;
+using stdext::hash_set;
+using stdext::hash_map;
+using std::list;
+using std::pair;
+}
+
#include "targetver.h"
#define _CRT_SECURE_NO_WARNINGS
@@ -41,6 +60,7 @@
#include "CommonStl.h"
#include "CoreUtilities.h"
+#include "CoreProject.h"
extern HRESULT check_location_compatibility(ICoreMetaObject *newobj, ICoreMetaObject *oldobj);
More information about the gme-commit
mailing list