From 07de9ab7fcfcc004eb30d8b5254a5981af3cf5ab Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 21 Mar 2012 09:55:48 +0100 Subject: Few simple performance fixes found with sysbench oltp.lua and Oprofile: - Avoid needless load/stores in my_hash_sort_simple due to possible aliasing - Avoid expensive Join_plan_state constructor in choose_subquery_plan when no subquery - Avoid calling update_virtual_fields for every row when no virtual fields. --- strings/ctype-simple.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'strings') diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index e60f9307e39..e25c0783abf 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -306,19 +306,24 @@ void my_hash_sort_simple(CHARSET_INFO *cs, { register const uchar *sort_order=cs->sort_order; const uchar *end; + ulong n1, n2; /* Remove end space. We have to do this to be able to compare 'A ' and 'A' as identical */ end= skip_trailing_space(key, len); - + + n1= *nr1; + n2= *nr2; for (; key < (uchar*) end ; key++) { - nr1[0]^=(ulong) ((((uint) nr1[0] & 63)+nr2[0]) * - ((uint) sort_order[(uint) *key])) + (nr1[0] << 8); - nr2[0]+=3; + n1^=(ulong) ((((uint) n1 & 63)+n2) * + ((uint) sort_order[(uint) *key])) + (n1 << 8); + n2+=3; } + *nr1= n1; + *nr2= n2; } -- cgit v1.2.1