diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-09-17 15:42:02 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-09-17 15:42:02 (GMT) |
commit | 9e8b7f29a08923e6c58692e8a6cabbeff08a1fc1 (patch) | |
tree | c01f746565a07960438881838e41c36c7edf4bc7 /src/H5T.c | |
parent | 5f326d50fae80e26c519a40e9b5d4e631ef7c5dc (diff) | |
download | hdf5-9e8b7f29a08923e6c58692e8a6cabbeff08a1fc1.zip hdf5-9e8b7f29a08923e6c58692e8a6cabbeff08a1fc1.tar.gz hdf5-9e8b7f29a08923e6c58692e8a6cabbeff08a1fc1.tar.bz2 |
[svn-r11424] Purpose:
Code cleanup/bug fix
Description:
Hoist function call out of inner loop of type conversion by retrieving
source & destination precisions once, outside the loop.
There's still some overhead because this information is stored in
variables set at run-time, when it's really constant for the particular
machine. Further work to set compiler macros would allow this code to be
optimized better by the compiler with dead code removal. We'll continue
to work on this area...
Also, made new internal H5T_compiler_conv routine static instead of of
private, until we need to reference it from another source code module.
Platforms tested:
h5committest
FreeBSD 4.11 (sleipnir)
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -263,6 +263,7 @@ static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func, hid_t dxpl_id); static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func, hid_t dxpl_id, hbool_t api_call); +static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst); static herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); static H5T_t *H5T_decode(const unsigned char *buf); @@ -2679,20 +2680,21 @@ H5Tcompiler_conv(hid_t src_id, hid_t dst_id) htri_t ret_value; H5T_t *src = NULL, *dst = NULL; - FUNC_ENTER_API(H5Tcompiler_conv, FAIL); + FUNC_ENTER_API(H5Tcompiler_conv, FAIL) /* Check args */ if (NULL == (src = H5I_object_verify(src_id,H5I_DATATYPE)) || NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") /* Find it */ if((ret_value=H5T_compiler_conv(src, dst))<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found"); + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } + /*------------------------------------------------------------------------- * Function: H5Tconvert @@ -4666,22 +4668,22 @@ H5T_path_bkg(const H5T_path_t *p) * *------------------------------------------------------------------------- */ -htri_t +static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst) { + H5T_path_t *path; htri_t ret_value; - H5T_path_t *path = NULL; - FUNC_ENTER_NOAPI(H5T_compiler_conv, FAIL); + FUNC_ENTER_NOAPI_NOINIT(H5T_compiler_conv) /* Find it */ if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found"); + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") ret_value = (htri_t)path->is_hard; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } |