Req #32727 [Opn->Csd]: Slow serialize on FreeBSD

From: Date: Wed, 10 Jun 2020 13:07:13 +0000
Subject: Req #32727 [Opn->Csd]: Slow serialize on FreeBSD
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227407@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=32727&edit=1 ID: 32727 Updated by: nikic@php.net Reported by: cws at miraclenet dot co dot th Summary: Slow serialize on FreeBSD -Status: Open +Status: Closed Type: Feature/Change Request Package: Variables related Operating System: FreeBSD PHP Version: 5.*, 4.* -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: At least in the current implementation, serialize uses PHP's own allocator, so this shouldn't be relevant anymore. Previous Comments: ------------------------------------------------------------------------ [2009-07-14 12:13:18] ale at FreeBSD dot org Can you try the following patch and tell me the results and which FreeBSD version you are using? --- ext/standard/php_smart_str.h.orig 2009-07-14 14:08:07.000000000 +0200 +++ ext/standard/php_smart_str.h 2009-07-14 14:08:12.000000000 +0200 @@ -30,12 +30,14 @@ #define smart_str_0(x) do { \ if ((x)->c) { \ + (x)->a = (x)->len; \ + SMART_STR_DO_REALLOC(x, 0); \ (x)->c[(x)->len] = '\0'; \ } \ } while (0) #ifndef SMART_STR_PREALLOC -#define SMART_STR_PREALLOC 128 +#define SMART_STR_PREALLOC 1048576 #endif #ifndef SMART_STR_START_SIZE ------------------------------------------------------------------------ [2007-06-05 08:37:30] runner at protom dot org I hope this patch to be taken in main ------------------------------------------------------------------------ [2005-04-19 02:48:30] cws at miraclenet dot co dot th I forget to mension that the previous result is from my patched version. The result of unpatch one is cws@t42# ./php test_serialize.php version:4.3.11 Length: 2798041 Serialize time: elapse(2.554760) ------------------------------------------------------------------------ [2005-04-19 02:36:12] cws at miraclenet dot co dot th No it don't help me to speed up my test code. This is the result cws@t42$ ./php test.php Content-type: text/html X-Powered-By: PHP/5.1.0-dev <PRE>version:5.1.0-dev Length: 2798041 Serialize time: elapse(2.136879) cws@t42$ /usr/local/bin/php test.php <PRE>version:4.3.11 Length: 2798041 Serialize time: elapse(0.200818) The test code and data can be download at http://freebie.miraclenet.co.th/tmp/test_serialize.tgz The test data may seem too extreme (an array of 2.8M) but it is the one that our customer really use. ------------------------------------------------------------------------ [2005-04-16 16:38:42] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip PHP 5.1-dev has got some optimizing done in this part, see if it's any better (without your patch of course) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=32727 -- Edit this bug report at https://bugs.php.net/bug.php?id=32727&edit=1

« previous php.bugs (#227407) next »