summaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-06-18 19:48:57 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-06-28 15:23:36 +0300
commit90038693903044bbbf7946ac128c3757ad33d7ba (patch)
treef3596c10eae1ed4d48ba5e4e6324ec5c63923aba /unittest
parentb3171607e3e3024ea493c785831a7421a36fa7fe (diff)
downloadmariadb-git-90038693903044bbbf7946ac128c3757ad33d7ba.tar.gz
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.
Diffstat (limited to 'unittest')
-rw-r--r--unittest/sql/mf_iocache-t.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
index a7db7c58713..36860892508 100644
--- a/unittest/sql/mf_iocache-t.cc
+++ b/unittest/sql/mf_iocache-t.cc
@@ -93,7 +93,7 @@ IO_CACHE info;
#define CACHE_SIZE 16384
#define INFO_TAIL ", pos_in_file = %llu, pos_in_mem = %lu", \
- info.pos_in_file, (ulong) (*info.current_pos - info.request_pos)
+ info.pos_in_file, (ulong) ((info.type == READ_CACHE ? info.read_pos : info.write_pos) - info.request_pos)
#define FILL 0x5A