Commit 98dc4142 authored by unknown's avatar unknown
Browse files

InnoDB: Some low-level optimizations made based on OProfile results.


innobase/dict/dict0mem.c:
  dict_mem_table_create(): Add a debug assertion.
innobase/include/btr0btr.ic:
  btr_node_ptr_get_child_page_no(): Add a UNIV_UNLIKELY hint.
  Remove a buf_frame_align() call.
innobase/include/btr0cur.ic:
  btr_cur_get_page(): Add a debug assertion.
innobase/include/buf0buf.ic:
  buf_block_peek_if_too_old(): Replace if() with return().
  buf_block_align(), buf_frame_align(): Add UNIV_UNLIKELY hints.
innobase/include/data0type.ic:
  dtype_get_fixed_size(): Add UNIV_UNLIKELY hints.
innobase/include/mem0mem.ic:
  Remove signedness warning in debug assertion.
innobase/include/read0read.ic:
  read_view_sees_trx_id(): Eliminate a comparison inside loop.
innobase/include/row0sel.ic:
  open_step(): Add UNIV_EXPECT hint.
innobase/include/row0upd.ic:
  upd_field_set_field_no(): Add a UNIV_UNLIKELY hint.
innobase/include/sync0rw.ic:
  Add UNIV_LIKELY and UNIV_UNLIKELY hints.
  rw_lock_x_lock_func_nowait(): Eliminate a function call.
  Replace ut_a() assertions with ut_ad().
innobase/include/trx0rseg.ic:
  Add UNIV_UNLIKELY hints.
innobase/include/ut0rnd.ic:
  ut_fold_binary(): Eliminate a loop variable
  to avoid register spilling on x86.
parent f2c13c3f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ dict_mem_table_create(
	mem_heap_t*	heap;
	
	ut_ad(name);
	ut_ad(comp == FALSE || comp == TRUE);

	heap = mem_heap_create(DICT_HEAP_SIZE);

+2 −2
Original line number Diff line number Diff line
@@ -200,10 +200,10 @@ btr_node_ptr_get_child_page_no(
	
	page_no = mach_read_from_4(field);

	if (page_no == 0) {
	if (UNIV_UNLIKELY(page_no == 0)) {
		fprintf(stderr,
"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
		       (unsigned long)(rec - buf_frame_align(rec)));
			(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE));
		buf_page_print(buf_frame_align(rec));
	}

+3 −1
Original line number Diff line number Diff line
@@ -52,7 +52,9 @@ btr_cur_get_page(
				/* out: pointer to page */
	btr_cur_t*	cursor)	/* in: tree cursor */
{
	return(buf_frame_align(page_cur_get_rec(&(cursor->page_cur))));
	page_t*	page = buf_frame_align(page_cur_get_rec(&(cursor->page_cur)));
	ut_ad(!!page_is_comp(page) == cursor->index->table->comp);
	return(page);
}

/*************************************************************
+6 −10
Original line number Diff line number Diff line
@@ -26,12 +26,8 @@ buf_block_peek_if_too_old(
				/* out: TRUE if should be made younger */
	buf_block_t*	block)	/* in: block to make younger */
{
	if (buf_pool->freed_page_clock >= block->freed_page_clock 
				+ 1 + (buf_pool->curr_size / 1024)) {
		return(TRUE);
	}

	return(FALSE);
	return(buf_pool->freed_page_clock >= block->freed_page_clock
				+ 1 + (buf_pool->curr_size / 1024));
}

/*************************************************************************
@@ -210,8 +206,8 @@ buf_block_align(

	frame_zero = buf_pool->frame_zero;

	if ((ulint)ptr < (ulint)frame_zero
	    || (ulint)ptr > (ulint)(buf_pool->high_end)) {
	if (UNIV_UNLIKELY((ulint)ptr < (ulint)frame_zero)
	    || UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) {

		ut_print_timestamp(stderr);	
		fprintf(stderr,
@@ -246,8 +242,8 @@ buf_frame_align(

	frame = ut_align_down(ptr, UNIV_PAGE_SIZE);

	if (((ulint)frame < (ulint)(buf_pool->frame_zero))
	    || (ulint)frame >= (ulint)(buf_pool->high_end)) {
	if (UNIV_UNLIKELY((ulint)frame < (ulint)(buf_pool->frame_zero))
	    || UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {

		ut_print_timestamp(stderr);	
		fprintf(stderr,
+2 −2
Original line number Diff line number Diff line
@@ -388,8 +388,8 @@ dtype_get_fixed_size(
					dtype_get_charset_coll(type->prtype),
					&mbminlen, &mbmaxlen);

				if (type->mbminlen != mbminlen
					|| type->mbmaxlen != mbmaxlen) {
				if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
				|| UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {

					ut_print_timestamp(stderr);
					fprintf(stderr, "  InnoDB: "
Loading