[libxml2] 574017 Realloc too expensive on most platform



commit ee20cd7ec9a2a3f7ab238e537575b6f624d336a8
Author: Daniel Veillard <veillard redhat com>
Date:   Sat Aug 22 15:18:31 2009 +0200

    574017 Realloc too expensive on most platform
    
    * tree.c: even on BSD there is too much of a penalty hit, to use
      the doubling buffer size strategy on all arches not just Windows.

 tree.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/tree.c b/tree.c
index 21670da..bce60d2 100644
--- a/tree.c
+++ b/tree.c
@@ -7073,11 +7073,13 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
     if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
     if (len + buf->use < buf->size) return(0);
 
-/*
- * Windows has a BIG problem on realloc timing, so we try to double
- * the buffer size (if that's enough) (bug 146697)
- */
-#ifdef WIN32
+    /*
+     * Windows has a BIG problem on realloc timing, so we try to double
+     * the buffer size (if that's enough) (bug 146697)
+     * Apparently BSD too, and it's probably best for linux too
+     * On an embedded system this may be something to change
+     */
+#if 1
     if (buf->size > len)
         size = buf->size * 2;
     else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]