Index: trunk/Mars/mcore/zofits.h
===================================================================
--- trunk/Mars/mcore/zofits.h	(revision 17238)
+++ trunk/Mars/mcore/zofits.h	(revision 17239)
@@ -61,9 +61,9 @@
         /// @param rowPerTile how many rows will be grouped together in a single tile
         /// @param maxUsableMem how many bytes of memory can be used by the compression buffers
-        zofits(uint32_t numTiles=1000,
-               uint32_t rowPerTile=100,
-               uint64_t maxUsableMem=0) : ofits(),
-                                          fMemPool(0, maxUsableMem),
-                                          fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
+        zofits(uint32_t numTiles    = fgNumTiles,
+               uint32_t rowPerTile  = fgRowPerTile,
+               uint64_t maxUsableMem= fgMaxUsableMem) : ofits(),
+                                                        fMemPool(0, maxUsableMem),
+                                                        fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
         {
             InitMemberVariables(numTiles, rowPerTile, maxUsableMem);
@@ -76,9 +76,9 @@
         /// @param maxUsableMem how many bytes of memory can be used by the compression buffers
         zofits(const char* fname,
-               uint32_t numTiles=1000,
-               uint32_t rowPerTile=100,
-               uint64_t maxUsableMem=0) : ofits(fname),
-                                          fMemPool(0, maxUsableMem),
-                                          fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
+               uint32_t numTiles    = fgNumTiles,
+               uint32_t rowPerTile  = fgRowPerTile,
+               uint64_t maxUsableMem= fgMaxUsableMem) : ofits(fname),
+                                                        fMemPool(0, maxUsableMem),
+                                                        fWriteToDiskQueue(bind(&zofits::WriteBufferToDisk, this, placeholders::_1), false)
         {
             InitMemberVariables(numTiles, rowPerTile, maxUsableMem);
@@ -578,6 +578,13 @@
 
         /// static setter for the default number of threads to use. -1 means all available physical cores
-        static void SetDefaultNumThreads(int32_t num) { fgNumQueues = num;}
-        static int32_t GetDefaultNumThreads() { return fgNumQueues;}
+        static void SetDefaultNumThreads   (int32_t num)   { fgNumQueues = num;}
+        static void SetDefaultNumTiles     (uint32_t num)  { fgNumTiles = num;}
+        static void SetDefaultNumRowPerTile(uint32_t num)  { fgRowPerTile = num;}
+        static void SetDefaultMaxUsableMem (uint64_t size) { fgMaxUsableMem = size;}
+
+        static int32_t GetDefaultNumThreads()     { return fgNumQueues;}
+        static uint32_t GetDefaultNumTiles()      { return fgNumTiles;}
+        static uint32_t GetDefaultNumRowPerTile() { return fgRowPerTile;}
+        static uint64_t GetDefaulMaxUsableMem()   { return fgMaxUsableMem;}
 
         /// Get and set the actual number of threads for this object
@@ -984,9 +991,12 @@
 
         //thread related stuff
-        MemoryManager  fMemPool;               ///< Actual memory manager, providing memory for the compression buffers
-        static int32_t fgNumQueues;           ///<  Default number of threads to be used by the objects
-        int32_t        fNumQueues;           ///<   Current number of threads that will be used by this object
-        uint64_t       fMaxUsableMem;       ///<    Maximum number of bytes that can be allocated by the memory manager
-        int32_t        fLatestWrittenTile; ///<     Index of the last tile written to disk (for correct ordering while using several threads)
+        MemoryManager   fMemPool;                  ///< Actual memory manager, providing memory for the compression buffers
+        static int32_t  fgNumQueues;              ///<  Default number of threads to be used by the objects
+        static uint32_t fgNumTiles;              ///< Default number of reserved tiles
+        static uint32_t fgRowPerTile;           ///< Default number of rows per tile
+        static uint64_t fgMaxUsableMem;        ///< Default usable memory PER OBJECT
+        int32_t         fNumQueues;           ///<   Current number of threads that will be used by this object
+        uint64_t        fMaxUsableMem;       ///<    Maximum number of bytes that can be allocated by the memory manager
+        int32_t         fLatestWrittenTile; ///<     Index of the last tile written to disk (for correct ordering while using several threads)
 
         vector<Queue<CompressionTarget>>          fCompressionQueues;  ///< Processing queues (=threads)
@@ -1002,10 +1012,11 @@
 
         typedef vector<CatalogEntry> CatalogRow;
-        typedef vector<CatalogRow>   CatalogType;
-        CatalogType fCatalog;              ///< Catalog for this file
-        uint32_t    fNumTiles;            ///<  Number of pre-reserved tiles
-        uint32_t    fNumRowsPerTile;     ///<   Number of rows per tile
-        off_t       fCatalogOffset;     ///<    Offset of the catalog from the beginning of the file
-        uint32_t    fCatalogExtraRows; ///<     Number of extra rows written on top of the initial capacity of the file
+        typedef vector<CatalogRow>     CatalogType;
+        CatalogType fCatalog;               ///< Catalog for this file
+//        uint32_t    fCatalogSize;          ///<  Actual catalog size (.size() is slow on large lists)
+        uint32_t    fNumTiles;            ///<   Number of pre-reserved tiles
+        uint32_t    fNumRowsPerTile;     ///<    Number of rows per tile
+        off_t       fCatalogOffset;     ///<     Offset of the catalog from the beginning of the file
+        uint32_t    fCatalogExtraRows; ///<      Number of extra rows written on top of the initial capacity of the file
 
         // checksum related stuff
@@ -1036,5 +1047,8 @@
 };
 
-int32_t zofits::fgNumQueues = 0;
+int32_t  zofits::fgNumQueues = 0;
+uint32_t zofits::fgNumTiles = 1000;
+uint32_t zofits::fgRowPerTile = 100;
+uint64_t zofits::fgMaxUsableMem = 1073741824; // one gigabyte
 
 #ifndef __MARS__
