diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-01 03:28:55 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-01 03:28:55 (GMT) |
commit | 67eb0968e1cc0e3d08c3f953a92a6ddb7ee980fe (patch) | |
tree | f52d9e2e1c3f7b9867d12debce5b10a50135bc90 | |
parent | f202e3dba4171dba3e5be2f4cee34445a5239875 (diff) | |
download | hdf5-67eb0968e1cc0e3d08c3f953a92a6ddb7ee980fe.zip hdf5-67eb0968e1cc0e3d08c3f953a92a6ddb7ee980fe.tar.gz hdf5-67eb0968e1cc0e3d08c3f953a92a6ddb7ee980fe.tar.bz2 |
[svn-r8455] Purpose:
Code optimization
Description:
Eliminate more 64-bit multiplies by remebering the size of contiguous
datasets as well as chunked datasets.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.9 (sleipnir)
too minor to require h5committest
-rw-r--r-- | src/H5D.c | 6 | ||||
-rw-r--r-- | src/H5Dseq.c | 18 | ||||
-rw-r--r-- | src/H5Fseq.c | 18 | ||||
-rw-r--r-- | src/H5Olayout.c | 4 |
4 files changed, 11 insertions, 35 deletions
@@ -2073,6 +2073,10 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space } else if (ndims>0 && max_dim[0]>new_dset->layout.dim[0]) { HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL, "extendible contiguous non-external dataset"); } + + /* Compute the total size of a chunk */ + for (u=1, new_dset->layout.chunk_size=new_dset->layout.dim[0]; u<new_dset->layout.ndims; u++) + new_dset->layout.chunk_size *= new_dset->layout.dim[u]; break; case H5D_CHUNKED: @@ -2104,7 +2108,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space 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++) + for (u=1, new_dset->layout.chunk_size=new_dset->layout.dim[0]; u<new_dset->layout.ndims; u++) new_dset->layout.chunk_size *= new_dset->layout.dim[u]; break; diff --git a/src/H5Dseq.c b/src/H5Dseq.c index 918b010..a51e554 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -230,15 +230,8 @@ H5F_seq_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_i buf))<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "external data read failed"); } else { - hsize_t max_data; /*bytes in dataset */ - unsigned u; /*counters */ - - /* Compute the size of the dataset in bytes */ - for(u=1, max_data=layout->dim[0]; u<layout->ndims; u++) - max_data *= layout->dim[u]; - /* Pass along the vector of sequences to read */ - if((ret_value=H5F_contig_readvv(f, max_data, layout->addr, + if((ret_value=H5F_contig_readvv(f, layout->chunk_size, layout->addr, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -346,15 +339,8 @@ H5F_seq_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, buf))<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "external data write failed"); } else { - hsize_t max_data; /* Bytes in dataset */ - unsigned u; /* Local index variable */ - - /* Compute the size of the dataset in bytes */ - for(u=1, max_data=layout->dim[0]; u<layout->ndims; u++) - max_data *= layout->dim[u]; - /* Pass along the vector of sequences to write */ - if ((ret_value=H5F_contig_writevv(f, max_data, layout->addr, + if ((ret_value=H5F_contig_writevv(f, layout->chunk_size, layout->addr, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) diff --git a/src/H5Fseq.c b/src/H5Fseq.c index 918b010..a51e554 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -230,15 +230,8 @@ H5F_seq_readvv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_i buf))<0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "external data read failed"); } else { - hsize_t max_data; /*bytes in dataset */ - unsigned u; /*counters */ - - /* Compute the size of the dataset in bytes */ - for(u=1, max_data=layout->dim[0]; u<layout->ndims; u++) - max_data *= layout->dim[u]; - /* Pass along the vector of sequences to read */ - if((ret_value=H5F_contig_readvv(f, max_data, layout->addr, + if((ret_value=H5F_contig_readvv(f, layout->chunk_size, layout->addr, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) @@ -346,15 +339,8 @@ H5F_seq_writevv(H5F_t *f, const struct H5D_dxpl_cache_t *dxpl_cache, buf))<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "external data write failed"); } else { - hsize_t max_data; /* Bytes in dataset */ - unsigned u; /* Local index variable */ - - /* Compute the size of the dataset in bytes */ - for(u=1, max_data=layout->dim[0]; u<layout->ndims; u++) - max_data *= layout->dim[u]; - /* Pass along the vector of sequences to write */ - if ((ret_value=H5F_contig_writevv(f, max_data, layout->addr, + if ((ret_value=H5F_contig_writevv(f, layout->chunk_size, layout->addr, dset_max_nseq, dset_curr_seq, dset_len_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, dxpl_id, buf))<0) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 9e92c3f..5dca442 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -147,9 +147,9 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_t p += mesg->size; } } - else if(mesg->type == H5D_CHUNKED) { + else if(mesg->type == H5D_CHUNKED || mesg->type == H5D_CONTIGUOUS) { /* Compute chunk size */ - for (u=0, mesg->chunk_size=1; u<mesg->ndims; u++) + for (u=1, mesg->chunk_size=mesg->dim[0]; u<mesg->ndims; u++) mesg->chunk_size *= mesg->dim[u]; } /* end if */ |