summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-05-12 18:44:26 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-05-12 18:44:26 (GMT)
commit13678f745b0051172587a15d79ea7c0c0f5a1d8c (patch)
tree6044cccb49d81f47ed4bd1b7cc8fadb117f3f0de /src/H5T.c
parent980683f1e1373f82e20d93846c138c4dc45952e0 (diff)
downloadhdf5-13678f745b0051172587a15d79ea7c0c0f5a1d8c.zip
hdf5-13678f745b0051172587a15d79ea7c0c0f5a1d8c.tar.gz
hdf5-13678f745b0051172587a15d79ea7c0c0f5a1d8c.tar.bz2
[svn-r8507] Purpose:
Code optimization Description: Eliminate many redundant lookups to check for no-op type conversion by remembering that a type conversion path is the no-op path. Also, don't allow non-no-op conversions which happen to be no-ops on a particular machine (such as int<->long conversions on machines where int and long are the same size and format, etc.) to replace the default no-op conversion. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) w/parallel
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 6f602c8..86a6734 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1285,8 +1285,10 @@ H5T_term_interface(void)
}
}
- H5T_close (path->src);
- H5T_close (path->dst);
+ if(path->src)
+ H5T_close (path->src);
+ if(path->dst)
+ H5T_close (path->dst);
H5FL_FREE(H5T_path_t,path);
H5T_g.path[i] = NULL;
}
@@ -2130,22 +2132,24 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
assert(name && *name);
if (H5T_PERS_HARD==pers) {
- /* Locate or create a new conversion path */
- if (NULL==(new_path=H5T_path_find(src, dst, name, func, dxpl_id)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path");
-
- /*
- * Notify all other functions to recalculate private data since some
- * functions might cache a list of conversion functions. For
- * instance, the compound type converter caches a list of conversion
- * functions for the members, so adding a new function should cause
- * the list to be recalculated to use the new function.
- */
- for (i=0; i<H5T_g.npaths; i++) {
- if (new_path != H5T_g.path[i])
- H5T_g.path[i]->cdata.recalc = TRUE;
- } /* end for */
-
+ /* Only bother to register the path if it's not a no-op path (for this machine) */
+ if(H5T_cmp(src, dst)) {
+ /* Locate or create a new conversion path */
+ if (NULL==(new_path=H5T_path_find(src, dst, name, func, dxpl_id)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path");
+
+ /*
+ * Notify all other functions to recalculate private data since some
+ * functions might cache a list of conversion functions. For
+ * instance, the compound type converter caches a list of conversion
+ * functions for the members, so adding a new function should cause
+ * the list to be recalculated to use the new function.
+ */
+ for (i=0; i<H5T_g.npaths; i++) {
+ if (new_path != H5T_g.path[i])
+ H5T_g.path[i]->cdata.recalc = TRUE;
+ } /* end for */
+ } /* end if */
} else {
/* Add function to end of soft list */
if (H5T_g.nsoft>=H5T_g.asoft) {
@@ -3806,6 +3810,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
#endif
H5E_clear(NULL); /*ignore the error*/
}
+ H5T_g.path[0]->is_noop = TRUE;
H5T_g.npaths = 1;
}
@@ -4030,7 +4035,7 @@ H5T_path_noop(const H5T_path_t *p)
assert(p);
- FUNC_LEAVE_NOAPI(p->is_hard && 0==H5T_cmp(p->src, p->dst));
+ FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0==H5T_cmp(p->src, p->dst)));
} /* end H5T_path_noop() */