mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-13 16:47:58 +08:00
[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)
This commit is contained in:
parent
5f326d50fa
commit
9e8b7f29a0
20
src/H5T.c
20
src/H5T.c
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
488
src/H5Tconv.c
488
src/H5Tconv.c
File diff suppressed because it is too large
Load Diff
@ -75,7 +75,6 @@ H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal);
|
||||
H5_DLL htri_t H5T_detect_class (const H5T_t *dt, H5T_class_t cls);
|
||||
H5_DLL size_t H5T_get_size(const H5T_t *dt);
|
||||
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
|
||||
H5_DLL htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst);
|
||||
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
|
||||
H5_DLL H5G_entry_t *H5T_entof(H5T_t *dt);
|
||||
H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
|
||||
|
Loading…
x
Reference in New Issue
Block a user