summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-04-06 13:37:48 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-04-06 13:37:48 (GMT)
commit8174e4c28643ba1b7f42fe1b8c5dc9f961aa2e5a (patch)
tree421026f1cc3340ca648a0daa1e61441fed63f78c /src/H5D.c
parentfc152eff1c4a7118f43bddb6ac3c9b3c4d69bfac (diff)
downloadhdf5-8174e4c28643ba1b7f42fe1b8c5dc9f961aa2e5a.zip
hdf5-8174e4c28643ba1b7f42fe1b8c5dc9f961aa2e5a.tar.gz
hdf5-8174e4c28643ba1b7f42fe1b8c5dc9f961aa2e5a.tar.bz2
[svn-r8304] 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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 37b0ba8..81bad5a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1844,7 +1844,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;
@@ -2038,11 +2037,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
@@ -2057,10 +2061,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)
+ 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");
- /* remember to check if size is small enough to fit header message */
-
}
break;