summaryrefslogtreecommitdiffstats
path: root/src/H5Gdense.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-03-03 15:54:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-03-03 15:54:16 (GMT)
commit65dc3358db37b04cc64b65b88065cbaf48e63a8b (patch)
tree41244d303977ed2870388bd782da9d19fc543270 /src/H5Gdense.c
parent33a65add7db18a4efd2b34ac8261c2065820ebf9 (diff)
downloadhdf5-65dc3358db37b04cc64b65b88065cbaf48e63a8b.zip
hdf5-65dc3358db37b04cc64b65b88065cbaf48e63a8b.tar.gz
hdf5-65dc3358db37b04cc64b65b88065cbaf48e63a8b.tar.bz2
[svn-r16537] Description:
Merge r16500:16536 from trunk into revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.6 (amazon) in debug mode Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5Gdense.c')
-rw-r--r--src/H5Gdense.c111
1 files changed, 66 insertions, 45 deletions
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 2bca4fa..6cc15b8 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -656,29 +656,34 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
/* Determine the address of the index to use */
if(idx_type == H5_INDEX_NAME) {
- /* Check if "native" order is OK - since names are hashed, getting them
- * in strictly increasing or decreasing order requires building a
- * table and sorting it.
+ /* Since names are hashed, getting them in strictly increasing or
+ * decreasing order requires building a table and sorting it.
+ * If the order is native, use the B-tree for names.
*/
- if(order == H5_ITER_NATIVE) {
- bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
- HDassert(H5F_addr_defined(bt2_addr));
- } /* end if */
- else
- bt2_addr = HADDR_UNDEF;
+ bt2_addr = HADDR_UNDEF;
} /* end if */
else {
HDassert(idx_type == H5_INDEX_CRT_ORDER);
/* This address may not be defined if creation order is tracked, but
* there's no index on it. If there's no v2 B-tree that indexes
- * the links, a table will be built.
+ * the links and the order is native, use the B-tree for names.
+ * Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
bt2_class = H5G_BT2_CORDER;
} /* end else */
+ /* If the order is native and there's no B-tree for indexing the links,
+ * use the B-tree for names instead of building a table to speed up the
+ * process.
+ */
+ if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
+ bt2_addr = linfo->name_bt2_addr;
+ bt2_class = H5G_BT2_NAME;
+ HDassert(H5F_addr_defined(bt2_addr));
+ } /* end if */
+
/* If there is an index defined for the field, use it */
if(H5F_addr_defined(bt2_addr)) {
H5G_bt2_ud_lbi_t udata; /* User data for v2 B-tree link lookup */
@@ -953,31 +958,37 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
/* Determine the address of the index to use */
if(idx_type == H5_INDEX_NAME) {
- /* Check if "native" order is OK - since names are hashed, getting them
- * in strictly increasing or decreasing order requires building a
- * table and sorting it.
+ /* Since names are hashed, getting them in strictly increasing or
+ * decreasing order requires building a table and sorting it. If
+ * the order is native, use the B-tree for names.
*/
- if(order == H5_ITER_NATIVE) {
- HDassert(H5F_addr_defined(linfo->name_bt2_addr));
- bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
- } /* end if */
- else
- bt2_addr = HADDR_UNDEF;
+ bt2_addr = HADDR_UNDEF;
} /* end if */
else {
HDassert(idx_type == H5_INDEX_CRT_ORDER);
/* This address may not be defined if creation order is tracked, but
* there's no index on it. If there's no v2 B-tree that indexes
- * the links, a table will be built.
+ * the links and the order is native, use the B-tree for names.
+ * Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
bt2_class = H5G_BT2_CORDER;
} /* end else */
+ /* If the order is native and there's no B-tree for indexing the links,
+ * use the B-tree for names instead of building a table to speed up the
+ * process.
+ */
+ if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
+ HDassert(H5F_addr_defined(linfo->name_bt2_addr));
+ bt2_addr = linfo->name_bt2_addr;
+ bt2_class = H5G_BT2_NAME;
+ } /* end if */
+
/* Check on iteration order */
- if(order == H5_ITER_NATIVE && H5F_addr_defined(bt2_addr)) {
+ if(order == H5_ITER_NATIVE) {
+ HDassert(H5F_addr_defined(bt2_addr));
H5G_bt2_ud_it_t udata; /* User data for iterator callback */
/* Open the fractal heap */
@@ -1146,29 +1157,34 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
/* Determine the address of the index to use */
if(idx_type == H5_INDEX_NAME) {
- /* Check if "native" order is OK - since names are hashed, getting them
- * in strictly increasing or decreasing order requires building a
- * table and sorting it.
+ /* Since names are hashed, getting them in strictly increasing or
+ * decreasing order requires building a table and sorting it. If
+ * the order is native, use the B-tree for names.
*/
- if(order == H5_ITER_NATIVE) {
- bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
- HDassert(H5F_addr_defined(bt2_addr));
- } /* end if */
- else
- bt2_addr = HADDR_UNDEF;
+ bt2_addr = HADDR_UNDEF;
} /* end if */
else {
HDassert(idx_type == H5_INDEX_CRT_ORDER);
/* This address may not be defined if creation order is tracked, but
* there's no index on it. If there's no v2 B-tree that indexes
- * the links, a table will be built.
+ * the links and the order is native, use the B-tree for names.
+ * Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
bt2_class = H5G_BT2_CORDER;
} /* end else */
+ /* If the order is native and there's no B-tree for indexing the links,
+ * use the B-tree for names instead of building a table to speed up the
+ * process.
+ */
+ if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
+ bt2_addr = linfo->name_bt2_addr;
+ bt2_class = H5G_BT2_NAME;
+ HDassert(H5F_addr_defined(bt2_addr));
+ } /* end if */
+
/* If there is an index defined for the field, use it */
if(H5F_addr_defined(bt2_addr)) {
H5G_bt2_ud_gnbi_t udata; /* User data for v2 B-tree callback */
@@ -1561,29 +1577,34 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
/* Determine the address of the index to use */
if(idx_type == H5_INDEX_NAME) {
- /* Check if "native" order is OK - since names are hashed, getting them
- * in strictly increasing or decreasing order requires building a
- * table and sorting it.
+ /* Since names are hashed, getting them in strictly increasing or
+ * decreasing order requires building a table and sorting it. If
+ * the order is native, use the B-tree for names.
*/
- if(order == H5_ITER_NATIVE) {
- bt2_addr = linfo->name_bt2_addr;
- bt2_class = H5G_BT2_NAME;
- HDassert(H5F_addr_defined(bt2_addr));
- } /* end if */
- else
- bt2_addr = HADDR_UNDEF;
+ bt2_addr = HADDR_UNDEF;
} /* end if */
else {
HDassert(idx_type == H5_INDEX_CRT_ORDER);
/* This address may not be defined if creation order is tracked, but
* there's no index on it. If there's no v2 B-tree that indexes
- * the links, a table will be built.
+ * the links and the order is native, use the B-tree for names.
+ * Otherwise, build a table.
*/
bt2_addr = linfo->corder_bt2_addr;
bt2_class = H5G_BT2_CORDER;
} /* end else */
+ /* If the order is native and there's no B-tree for indexing the links,
+ * use the B-tree for names instead of building a table to speed up the
+ * process.
+ */
+ if(order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) {
+ bt2_addr = linfo->name_bt2_addr;
+ bt2_class = H5G_BT2_NAME;
+ HDassert(H5F_addr_defined(bt2_addr));
+ } /* end if */
+
/* If there is an index defined for the field, use it */
if(H5F_addr_defined(bt2_addr)) {
H5G_bt2_ud_rmbi_t udata; /* User data for v2 B-tree record removal */