List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:May 9 2005 7:59am
Subject:bk commit into 5.1 tree (stewart:1.1830)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1830 05/05/09 09:59:08 stewart@stripped +1 -0
  Optimise bitvector to avoid malloc
  
  (profiling showed that this can make a speed improvement for ndb injector thread)

  sql/bitvector.h
    1.2 05/05/09 09:59:00 stewart@stripped +8 -2
    Avoid a malloc on the common case (where common case= using it for fields in NDB tables)

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	stewart
# Host:	kennedy.(none)
# Root:	/home/stewart/Documents/MySQL/5.1/wl2325

--- 1.1/sql/bitvector.h	2005-04-26 12:20:01 +02:00
+++ 1.2/sql/bitvector.h	2005-05-09 09:59:00 +02:00
@@ -135,8 +135,13 @@
   }
 
   explicit bitvector(size_t size, bool value= false) 
-    : m_size(size), m_data(my_malloc(byte_size(size), MYF(0)))
+    : m_size(size)
   {
+    if(byte_size(size)<=sizeof(smalldata))
+      m_data= smalldata;
+    else
+      m_data= my_malloc(byte_size(size), MYF(0));
+
     if (value)
       set_all();
     else
@@ -171,7 +176,7 @@
 
   ~bitvector() 
   {
-    if (m_data)
+    if (m_data && m_data!=smalldata)
       my_free(m_data, MYF(0));
   }
 
@@ -249,6 +254,7 @@
 private:
   size_t m_size;
   byte *m_data;
+  byte smalldata[16];
 };
 
 #endif /* BITVECTOR_H */
Thread
bk commit into 5.1 tree (stewart:1.1830)Stewart Smith9 May