Set reasonable defaults for caching behavior

This commit is contained in:
Thomas Krijnen
2016-05-01 20:38:10 +02:00
parent c6d5adfa42
commit a1d584796a
2 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -46,7 +46,9 @@
#include "../ifcgeom/IfcRepresentationShapeItem.h"
#include "../ifcgeom/IfcGeomShapeType.h"
#define NO_CACHE
// Define this in case you want to conserve memory usage at all cost. This has been
// benchmarked extensively: https://github.com/IfcOpenShell/IfcOpenShell/pull/47
// #define NO_CACHE
#ifdef NO_CACHE
+6 -2
View File
@@ -324,8 +324,12 @@ namespace IfcGeom {
private:
// Move to the next IfcRepresentation
void _nextShape() {
if (done % 100 == 99) {
// kernel.purge_cache();
// In order to conserve memory and reduce cache insertion times, the cache is
// cleared after an arbitary number of processed representations. This has been
// benchmarked extensively: https://github.com/IfcOpenShell/IfcOpenShell/pull/47
static const int clear_interval = 64;
if (done % clear_interval == clear_interval - 1) {
kernel.purge_cache();
}
ifcproducts.reset();
++ representation_iterator;