From 0f745e0113378668bf4745a6acbfad52e54d030d Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Sat, 18 Apr 2020 13:55:47 +0200 Subject: [PATCH] C: Columns: optimizing column file growth --- python/obitools3/version.py | 2 +- src/obidmscolumn.c | 4 ++++ src/obidmscolumn.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/obitools3/version.py b/python/obitools3/version.py index 606976a..693bf2e 100755 --- a/python/obitools3/version.py +++ b/python/obitools3/version.py @@ -1,5 +1,5 @@ major = 3 minor = 0 -serial= '0-beta14a' +serial= '0-beta14b' version ="%d.%02d.%s" % (major,minor,serial) diff --git a/src/obidmscolumn.c b/src/obidmscolumn.c index 9ab5ecf..ff1fc73 100644 --- a/src/obidmscolumn.c +++ b/src/obidmscolumn.c @@ -1974,6 +1974,10 @@ int obi_enlarge_column(OBIDMS_column_p column) // Calculate the new file size old_line_count = (column->header)->line_count; new_line_count = ceil((double) old_line_count * (double) COLUMN_GROWTH_FACTOR); + if (new_line_count > old_line_count+100000) + new_line_count = old_line_count+100000; + else if (new_line_count < old_line_count+1000) + new_line_count = old_line_count+1000; if (new_line_count > MAXIMUM_LINE_COUNT) { diff --git a/src/obidmscolumn.h b/src/obidmscolumn.h index f4cadde..c571345 100755 --- a/src/obidmscolumn.h +++ b/src/obidmscolumn.h @@ -34,7 +34,7 @@ #define NB_ELTS_MAX_IF_DEFAULT_NAME (1000000) /**< The maximum number of elements per line if the default element names * are used ("0\01\02\0...\0n"), considering ELEMENTS_NAMES_MAX. // TODO not up to date */ -#define COLUMN_GROWTH_FACTOR (1.3) /**< The growth factor when a column is enlarged. +#define COLUMN_GROWTH_FACTOR (2) /**< The growth factor when a column is enlarged. */ #define MAXIMUM_LINE_COUNT (1000000000) /**< The maximum line count for the data of a column (1E9). //TODO */