8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:03:04 +01:00

This trivial optimization saves a few percents of performance when reading/writing DBKEYs from/to compatible local variables.

This commit is contained in:
dimitr 2013-01-24 09:30:38 +00:00
parent a7a6a45ec2
commit 0c2a0fead7

View File

@ -1308,6 +1308,21 @@ void CVT_move_common(const dsc* from, dsc* to, Callbacks* cb)
return;
}
// Special optimization case: RDB$DB_KEY is binary compatible with CHAR(8) OCTETS
if ((from->dsc_dtype == dtype_text &&
to->dsc_dtype == dtype_dbkey &&
from->dsc_ttype() == ttype_binary &&
from->dsc_length == to->dsc_length) ||
(to->dsc_dtype == dtype_text &&
from->dsc_dtype == dtype_dbkey &&
to->dsc_ttype() == ttype_binary &&
from->dsc_length == to->dsc_length))
{
memcpy(p, q, length);
return;
}
// Do data type by data type conversions. Not all are supported,
// and some will drop out for additional handling.
@ -2322,7 +2337,6 @@ SQUAD CVT_get_quad(const dsc* desc, SSHORT scale, ErrorFunction err)
*
**************************************/
SQUAD value;
double d;
VaryStr<50> buffer; // long enough to represent largest quad in ASCII
// adjust exact numeric values to same scaling