adjust the size of the memory pools

This commit is contained in:
Lee Thomason (grinliz) 2013-02-01 09:02:34 -08:00
parent c97ded4872
commit ac83b4e278
3 changed files with 19 additions and 9 deletions

View File

@ -1502,11 +1502,11 @@ XMLDocument::~XMLDocument()
DeleteChildren(); DeleteChildren();
delete [] _charBuffer; delete [] _charBuffer;
#if 0 #if 1
textPool.Trace( "text" ); _textPool.Trace( "text" );
elementPool.Trace( "element" ); _elementPool.Trace( "element" );
commentPool.Trace( "comment" ); _commentPool.Trace( "comment" );
attributePool.Trace( "attribute" ); _attributePool.Trace( "attribute" );
#endif #endif
#ifdef DEBUG #ifdef DEBUG

View File

@ -98,9 +98,9 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
#define TIXML_SSCANF sscanf #define TIXML_SSCANF sscanf
#endif #endif
static const int TIXML2_MAJOR_VERSION = 1; static const int TIXML2_MAJOR_VERSION = 1;
static const int TIXML2_MINOR_VERSION = 0; static const int TIXML2_MINOR_VERSION = 0;
static const int TIXML2_PATCH_VERSION = 10; static const int TIXML2_PATCH_VERSION = 10;
namespace tinyxml2 namespace tinyxml2
{ {
@ -359,7 +359,16 @@ public:
return _nUntracked; return _nUntracked;
} }
enum { COUNT = 1024/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private // This number is perf sensitive. 4k seems like a good tradeoff on my machine.
// The test file is large, 170k.
// Release: VS2010 gcc(no opt)
// 1k: 4000
// 2k: 4000
// 4k: 3900 21000
// 16k: 5200
// 32k: 4300
// 64k: 4000 21000
enum { COUNT = (4*1024)/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private
private: private:
union Chunk { union Chunk {

View File

@ -289,6 +289,7 @@ int main( int argc, const char ** argv )
if ( !errorID ) { if ( !errorID ) {
printf( "Load time=%d\n", loadTime - startTime ); printf( "Load time=%d\n", loadTime - startTime );
printf( "Delete time=%d\n", deleteTime - loadTime ); printf( "Delete time=%d\n", deleteTime - loadTime );
printf( "Total time=%d\n", deleteTime - startTime );
} }
exit(0); exit(0);
} }