summaryrefslogtreecommitdiffstats
path: root/src/H5Distore.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-07-12 16:50:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-07-12 16:50:49 (GMT)
commit9e7fcd24e35f237c83cd241de0f87742f202e7a8 (patch)
treec161429512d2142d1c59082bc43df7ad92b30277 /src/H5Distore.c
parentd50d5cae24187f788cefa8c0d7b9397e7bffe8fb (diff)
downloadhdf5-9e7fcd24e35f237c83cd241de0f87742f202e7a8.zip
hdf5-9e7fcd24e35f237c83cd241de0f87742f202e7a8.tar.gz
hdf5-9e7fcd24e35f237c83cd241de0f87742f202e7a8.tar.bz2
[svn-r8862] Purpose:
Code optimization Description: Avoid calling vector comparison routine when operating on 1-D chunks. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.10 (sleipnir) w/parallel Too minor to require h5committest
Diffstat (limited to 'src/H5Distore.c')
-rw-r--r--src/H5Distore.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c
index e5113a9..2a85991 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -520,11 +520,17 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
assert(udata);
assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
-#ifdef NEW_WAY
/* Special case for faster checks on 1-D chunks */
/* (Checking for ndims==2 because last dimension is the datatype size) */
+ /* The additional checking for the right key is necessary due to the */
+ /* slightly odd way the library initializes the right-most node in the */
+ /* indexed storage B-tree... */
+ /* (Dump the B-tree with h5debug to look at it) -QAK */
if(udata->mesg->u.chunk.ndims==2) {
- if(udata->key.offset[0]>=rt_key->offset[0])
+ if(udata->key.offset[0]>rt_key->offset[0])
+ ret_value=1;
+ else if(udata->key.offset[0]==rt_key->offset[0] &&
+ udata->key.offset[1]>=rt_key->offset[1])
ret_value=1;
else if(udata->key.offset[0]<lt_key->offset[0])
ret_value=(-1);
@@ -537,14 +543,6 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda
lt_key->offset))
ret_value = -1;
} /* end else */
-#else /* NEW_WAY */
- if (H5V_vector_ge_s(udata->mesg->u.chunk.ndims, udata->key.offset,
- rt_key->offset))
- ret_value = 1;
- else if (H5V_vector_lt_s(udata->mesg->u.chunk.ndims, udata->key.offset,
- lt_key->offset))
- ret_value = -1;
-#endif /* NEW_WAY */
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5D_istore_cmp3() */
@@ -3281,7 +3279,9 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden
{
H5O_layout_t layout;
H5D_istore_ud1_t udata;
- herr_t ret_value=SUCCEED;
+ H5B_shared_t *shared; /* Shared B-tree node info */
+ size_t u; /* Local index variable */
+ herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5D_istore_debug,FAIL);
@@ -3289,8 +3289,35 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden
layout.u.chunk.ndims = ndims;
udata.mesg = &layout;
+ /* Allocate space for the shared structure */
+ if(NULL==(shared=H5FL_MALLOC(H5B_shared_t)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info")
+
+ /* Set up the "global" information for this file's groups */
+ shared->type= H5B_ISTORE;
+ shared->sizeof_rkey = H5D_istore_sizeof_rkey(f, &udata);
+ assert(shared->sizeof_rkey);
+ shared->sizeof_rnode = H5B_nodesize(f, H5B_ISTORE, &shared->sizeof_keys, shared->sizeof_rkey);
+ assert(shared->sizeof_rnode);
+ if(NULL==(shared->page=H5FL_BLK_MALLOC(chunk_page,shared->sizeof_rnode)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree page")
+ if(NULL==(shared->nkey=H5FL_SEQ_MALLOC(size_t,(size_t)(2*H5F_KVALUE(f,H5B_ISTORE)+1))))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree page")
+
+ /* Initialize the offsets into the native key buffer */
+ for(u=0; u<(2*H5F_KVALUE(f,H5B_ISTORE)+1); u++)
+ shared->nkey[u]=u*H5B_ISTORE->sizeof_nkey;
+
+ /* Make shared B-tree info reference counted */
+ if(NULL==(layout.u.chunk.btree_shared=H5RC_create(shared,H5D_istore_shared_free)))
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
+
H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata);
+ /* Free the raw B-tree node buffer */
+ if(H5RC_DEC(layout.u.chunk.btree_shared)<0)
+ HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page");
+
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5D_istore_debug() */