List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:March 1 2011 12:38pm
Subject:bzr commit into mysql-trunk branch (guilhem.bichot:3273)
View as plain text  
#At file:///home/mysql_src/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/ based on revid:guilhem.bichot@stripped

 3273 Guilhem Bichot	2011-03-01
      When pre-allocating the trace buffer, multiply the current allocated
      length. This is said to perform better than addition of 1kB,
      when the trace gets large.

    modified:
      sql/opt_trace.cc
=== modified file 'sql/opt_trace.cc'
--- a/sql/opt_trace.cc	2011-03-01 10:55:27 +0000
+++ b/sql/opt_trace.cc	2011-03-01 12:38:28 +0000
@@ -951,8 +951,8 @@ bool Opt_trace_stmt::Buffer::append(char
 bool Opt_trace_stmt::Buffer::prealloc()
 {
   const size_t alloced=   alloced_length();
-  const size_t increment= 1024;
-  if ((alloced - length()) < (increment / 3))
+  const size_t first_increment= 1024;
+  if ((alloced - length()) < (first_increment / 3))
   {
     /*
       Support for I_S will produce long strings, and there is little free
@@ -963,8 +963,9 @@ bool Opt_trace_stmt::Buffer::prealloc()
       with a hole if there is later memory again for the trace's
       continuation. The statement will fail anyway due to my_error(), in the
       server.
-      */
-    size_t new_size= alloced + increment;
+      We jump from 0 to first_increment and then multiply by 1.5.
+    */
+    size_t new_size= (alloced == 0) ? first_increment : (alloced * 15 / 10);
     size_t max_size= allowed_mem_size;
     /*
       Determine a safety margin:


Attachment: [text/bzr-bundle] bzr/guilhem.bichot@oracle.com-20110301123828-ta5kf7ewbox5wp9j.bundle
Thread
bzr commit into mysql-trunk branch (guilhem.bichot:3273) Guilhem Bichot1 Mar