Browse Source

branches/zip: Minor performance tuning based on measurement data

on mispredicted branches: opcontrol --event=BR_CND_MISSP_EXEC:45000

UT_SORT_FUNCTION_BODY(): Copy the array with memcpy(3).

cmp_dtuple_rec_with_match(), cmp_rec_rec_with_match(),
cmp_debug_dtuple_rec_with_match(): Add UNIV_UNLIKELY hints around
tests for REC_INFO_MIN_REC_FLAG.
pull/374/head
marko 18 years ago
parent
commit
ef91b93e6d
  1. 5
      include/ut0sort.h
  2. 23
      rem/rem0cmp.c

5
include/ut0sort.h

@ -80,9 +80,8 @@ two elements from the array and returns 1, if the first is bigger,
}\
}\
\
for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\
(ARR)[ut_sort_i77] = (AUX_ARR)[ut_sort_i77];\
}\
memcpy((ARR) + (LOW), (AUX_ARR) + (LOW),\
((HIGH) - (LOW)) * sizeof *(ARR));\
}\

23
rem/rem0cmp.c

@ -459,10 +459,10 @@ cmp_dtuple_rec_with_match(
rec_offs_comp(offsets));
ulint tup_info = dtuple_get_info_bits(dtuple);
if (rec_info & REC_INFO_MIN_REC_FLAG) {
if (UNIV_UNLIKELY(rec_info & REC_INFO_MIN_REC_FLAG)) {
ret = !(tup_info & REC_INFO_MIN_REC_FLAG);
goto order_resolved;
} else if (tup_info & REC_INFO_MIN_REC_FLAG) {
} else if (UNIV_UNLIKELY(tup_info & REC_INFO_MIN_REC_FLAG)) {
ret = -1;
goto order_resolved;
}
@ -598,7 +598,7 @@ cmp_dtuple_rec_with_match(
}
ret = (int) (dtuple_byte - rec_byte);
if (UNIV_UNLIKELY(ret)) {
if (UNIV_LIKELY(ret)) {
if (ret < 0) {
ret = -1;
goto order_resolved;
@ -940,8 +940,8 @@ cmp_rec_rec_with_match(
if (cur_field == 0) {
/* Test if rec is the predefined minimum
record */
if (rec_get_info_bits(rec1, comp)
& REC_INFO_MIN_REC_FLAG) {
if (UNIV_UNLIKELY(rec_get_info_bits(rec1, comp)
& REC_INFO_MIN_REC_FLAG)) {
if (!(rec_get_info_bits(rec2, comp)
& REC_INFO_MIN_REC_FLAG)) {
@ -950,8 +950,9 @@ cmp_rec_rec_with_match(
goto order_resolved;
} else if (rec_get_info_bits(rec2, comp)
& REC_INFO_MIN_REC_FLAG) {
} else if (UNIV_UNLIKELY
(rec_get_info_bits(rec2, comp)
& REC_INFO_MIN_REC_FLAG)) {
ret = 1;
@ -1148,8 +1149,9 @@ cmp_debug_dtuple_rec_with_match(
cur_field = *matched_fields;
if (cur_field == 0) {
if (rec_get_info_bits(rec, rec_offs_comp(offsets))
& REC_INFO_MIN_REC_FLAG) {
if (UNIV_UNLIKELY
(rec_get_info_bits(rec, rec_offs_comp(offsets))
& REC_INFO_MIN_REC_FLAG)) {
ret = !(dtuple_get_info_bits(dtuple)
& REC_INFO_MIN_REC_FLAG);
@ -1157,7 +1159,8 @@ cmp_debug_dtuple_rec_with_match(
goto order_resolved;
}
if (dtuple_get_info_bits(dtuple) & REC_INFO_MIN_REC_FLAG) {
if (UNIV_UNLIKELY
(dtuple_get_info_bits(dtuple) & REC_INFO_MIN_REC_FLAG)) {
ret = -1;
goto order_resolved;

Loading…
Cancel
Save