summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-06 13:37:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-06 13:37:18 (GMT)
commit394dace97be91c6b4a5d1dc23538cc2c12566fb8 (patch)
treeb60b45012c334436c0fa11b5adcfab7ad128322b /src/H5D.c
parent43d3a9bfe8dfc060615b4a0f133ebf35bcb0f2f8 (diff)
downloadhdf5-394dace97be91c6b4a5d1dc23538cc2c12566fb8.zip
hdf5-394dace97be91c6b4a5d1dc23538cc2c12566fb8.tar.gz
hdf5-394dace97be91c6b4a5d1dc23538cc2c12566fb8.tar.bz2
[svn-r8303] Purpose:
Code optimization Description: Compute the size of a chunk once, when the layout information is set, instead of each time I/O is performed on the chunk. Platforms tested: h5committest Solaris 2.7 (arabica)
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 18f4c58..fa20fd4 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1845,7 +1845,6 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
const H5T_t *type; /* Datatype for dataset */
H5D_t *new_dset = NULL;
int i, ndims;
- hsize_t comp_data_size;
unsigned u;
hsize_t max_dim[H5O_LAYOUT_NDIMS]={0};
H5F_t *file=NULL;
@@ -2041,11 +2040,16 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
/* Set the dataset's chunk sizes from the property list's chunk sizes */
for (u=0; u<new_dset->layout.ndims-1; u++)
new_dset->layout.dim[u] = chunk_size[u];
+
+ /* Compute the total size of a chunk */
+ for (u=0, new_dset->layout.chunk_size=1; u<new_dset->layout.ndims; u++)
+ new_dset->layout.chunk_size *= new_dset->layout.dim[u];
break;
case H5D_COMPACT:
{
hssize_t tmp_size; /* Temporary holder for raw data size */
+ hsize_t comp_data_size;
/*
* Compact dataset is stored in dataset object header message of
@@ -2060,10 +2064,8 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
comp_data_size=H5O_MAX_SIZE-H5O_layout_meta_size(file, &(new_dset->layout));
if(new_dset->layout.size > comp_data_size)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "compact dataset size is bigger than header message maximum size")
- if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim, max_dim))<0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize dimension size of compact dataset storage")
- /* remember to check if size is small enough to fit header message */
-
+ if (H5S_get_simple_extent_dims(space, new_dset->layout.dim, NULL)<0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize dimension size of compact dataset storage");
}
break;