From 90038693903044bbbf7946ac128c3757ad33d7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sun, 18 Jun 2017 19:48:57 +0300 Subject: Simplify IO_CACHE by removing current_pos and end_pos as self-references These self references were previously used to avoid having to check the IO_CACHE's type. However, a benchmark shows that on x86 5930k stock, the type comparison is marginally faster than the double pointer dereference. For 40 billion my_b_tell calls, the difference is .1 seconds in favor of performing the type check. (Basically there is no measurable difference) To prevent bugs from copying the structure using the equals(=) operator, and having to do the bookkeeping manually, remove these "convenience" variables. --- sql/filesort.cc | 3 --- 1 file changed, 3 deletions(-) (limited to 'sql') diff --git a/sql/filesort.cc b/sql/filesort.cc index 83c8442937e..2388dd759b5 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1483,8 +1483,6 @@ int merge_many_buff(Sort_param *param, uchar *sort_buffer, if (flush_io_cache(to_file)) break; /* purecov: inspected */ temp=from_file; from_file=to_file; to_file=temp; - setup_io_cache(from_file); - setup_io_cache(to_file); *maxbuffer= (uint) (lastbuff-buffpek)-1; } cleanup: @@ -1492,7 +1490,6 @@ cleanup: if (to_file == t_file) { *t_file=t_file2; // Copy result file - setup_io_cache(t_file); } DBUG_RETURN(*maxbuffer >= MERGEBUFF2); /* Return 1 if interrupted */ -- cgit v1.2.1