Does smart_str realloc at the end? If not, then this patch can lead to much higher memory use. From our tests we found 5.1 to use more memory and this was part of the reason for some slowdown. Even if a micro benchmark can show this to be faster, for real world apps and the various CPUs we are probably in better shape, when leaving this a low but good default. You could even run a few apps and see what default size works for the 90% of allocations. That's probably a good # to go with.

Andi

At 06:52 AM 5/2/2006, Ilia Alshanetsky wrote:
iliaa           Tue May  2 13:52:25 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/ext/standard       php_smart_str.h
  Log:
  Attempt to increase smart_str performance through the use of larger
  default buffers. Biased micro benchmarks show it makes sense :P


http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/php_smart_str.h?r1=1.30.2.1&r2=1.30.2.2&diff_format=u
Index: php-src/ext/standard/php_smart_str.h
diff -u php-src/ext/standard/php_smart_str.h:1.30.2.1 php-src/ext/standard/php_smart_str.h:1.30.2.2 --- php-src/ext/standard/php_smart_str.h:1.30.2.1 Sun Jan 1 12:50:15 2006
+++ php-src/ext/standard/php_smart_str.h        Tue May  2 13:52:24 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */

-/* $Id: php_smart_str.h,v 1.30.2.1 2006/01/01 12:50:15 sniper Exp $ */
+/* $Id: php_smart_str.h,v 1.30.2.2 2006/05/02 13:52:24 iliaa Exp $ */

 #ifndef PHP_SMART_STR_H
 #define PHP_SMART_STR_H
@@ -35,11 +35,11 @@
 } while (0)

 #ifndef SMART_STR_PREALLOC
-#define SMART_STR_PREALLOC 128
+#define SMART_STR_PREALLOC 4096
 #endif

 #ifndef SMART_STR_START_SIZE
-#define SMART_STR_START_SIZE 78
+#define SMART_STR_START_SIZE 1024
 #endif

 #ifdef SMART_STR_USE_REALLOC

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to