| Summary: | lang/php4 - Slow serialize on FreeBSD | ||
|---|---|---|---|
| Product: | Ports & Packages | Reporter: | Chatchawan Wongsiriprasert <cws> |
| Component: | Individual Port(s) | Assignee: | Alex Dupre <ale> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Chatchawan Wongsiriprasert
2005-05-16 07:50:02 UTC
Responsible Changed From-To: freebsd-ports-bugs->ale Over to maintainer On PHP 5, this is a slighty modified version of this code but the same principe. Can't test http://freebie.miraclenet.co.th/tmp/test_serialize.tgz, 404 error. Can you try the following patch (for PHP5) 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
--
Alex Dupre
State Changed From-To: open->feedback Waiting for feedback. The problem is not exists anymore FreeBSD 7/PHP 5
The result without apply any patch to FreeBSD7/PHP5
OS : FreeBSD 7.1-RELEASE amd64
PHP Version:5.2.9
Serialize result length:9022301
Serialize time :0.065906 second
Test code:
<?php
$a = array();
for($i = 0; $i < 1024; ++$i)
{
$test_ch = chr($i % 26+ord('A'));
$a[] = array(
'id' => $i,
'ch1' => str_repeat($test_ch,255),
'ch2' =>
str_repeat(strtolower($test_ch),255),
'data3' => str_repeat('A',4096),
'data4' => str_repeat('B',4096),
);
}
$st = microtime_float();
$str = serialize($a);
$end = microtime_float();
print "OS :" . `/usr/bin/uname -rps` . "\n";
print "PHP Version:" . phpversion() . "\n";
print "Serialize result length:" . strlen($str) . "\n";
print "Serialize time :" . sprintf("%f second\n",$end-$st);
?>
<?php
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
?>
State Changed From-To: feedback->closed Closed as submitter request. |