mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:04:13 +08:00
mdbx: more likely/unlikely for mdb_node_add.
Change-Id: I1f241c6cea55db6fed744ba9f6f5733f6622015f
This commit is contained in:
parent
4d3e349c16
commit
7c3c28239c
12
mdb.c
12
mdb.c
@ -7327,10 +7327,10 @@ mdb_node_add(MDB_cursor *mc, indx_t indx,
|
|||||||
node_size += key->mv_size;
|
node_size += key->mv_size;
|
||||||
if (IS_LEAF(mp)) {
|
if (IS_LEAF(mp)) {
|
||||||
mdb_cassert(mc, key && data);
|
mdb_cassert(mc, key && data);
|
||||||
if (F_ISSET(flags, F_BIGDATA)) {
|
if (unlikely(F_ISSET(flags, F_BIGDATA))) {
|
||||||
/* Data already on overflow page. */
|
/* Data already on overflow page. */
|
||||||
node_size += sizeof(pgno_t);
|
node_size += sizeof(pgno_t);
|
||||||
} else if (node_size + data->mv_size > mc->mc_txn->mt_env->me_nodemax) {
|
} else if (unlikely(node_size + data->mv_size > mc->mc_txn->mt_env->me_nodemax)) {
|
||||||
int ovpages = OVPAGES(data->mv_size, mc->mc_txn->mt_env->me_psize);
|
int ovpages = OVPAGES(data->mv_size, mc->mc_txn->mt_env->me_psize);
|
||||||
int rc;
|
int rc;
|
||||||
/* Put data on overflow page. */
|
/* Put data on overflow page. */
|
||||||
@ -7378,19 +7378,19 @@ update:
|
|||||||
|
|
||||||
if (IS_LEAF(mp)) {
|
if (IS_LEAF(mp)) {
|
||||||
ndata = NODEDATA(node);
|
ndata = NODEDATA(node);
|
||||||
if (ofp == NULL) {
|
if (unlikely(ofp == NULL)) {
|
||||||
if (F_ISSET(flags, F_BIGDATA))
|
if (unlikely(F_ISSET(flags, F_BIGDATA)))
|
||||||
memcpy(ndata, data->mv_data, sizeof(pgno_t));
|
memcpy(ndata, data->mv_data, sizeof(pgno_t));
|
||||||
else if (F_ISSET(flags, MDB_RESERVE))
|
else if (F_ISSET(flags, MDB_RESERVE))
|
||||||
data->mv_data = ndata;
|
data->mv_data = ndata;
|
||||||
else if (ndata != data->mv_data)
|
else if (likely(ndata != data->mv_data))
|
||||||
memcpy(ndata, data->mv_data, data->mv_size);
|
memcpy(ndata, data->mv_data, data->mv_size);
|
||||||
} else {
|
} else {
|
||||||
memcpy(ndata, &ofp->mp_pgno, sizeof(pgno_t));
|
memcpy(ndata, &ofp->mp_pgno, sizeof(pgno_t));
|
||||||
ndata = PAGEDATA(ofp);
|
ndata = PAGEDATA(ofp);
|
||||||
if (F_ISSET(flags, MDB_RESERVE))
|
if (F_ISSET(flags, MDB_RESERVE))
|
||||||
data->mv_data = ndata;
|
data->mv_data = ndata;
|
||||||
else if (ndata != data->mv_data)
|
else if (likely(ndata != data->mv_data))
|
||||||
memcpy(ndata, data->mv_data, data->mv_size);
|
memcpy(ndata, data->mv_data, data->mv_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user