[
https://issues.apache.org/jira/browse/THRIFT-3732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
jiang dongliang updated THRIFT-3732:
------------------------------------
Description:
It's not necessary to get the instance inside the while loop.
for example file TTransport.php
public function readAll($len)
{
// return $this->read($len);
$data = '';
$got = 0;
/** original
while (($got = TStringFuncFactory::create()->strlen($data)) < $len) {
$data .= $this->read($len - $got);
}
*/
$factory = TStringFuncFactory::create();
while (($got = $factory->strlen($data)) < $len) {
$data .= $this->read($len - $got);
}
return $data;
}
was:
file TTransport.php
public function readAll($len)
{
// return $this->read($len);
$data = '';
$got = 0;
/** original
while (($got = TStringFuncFactory::create()->strlen($data)) < $len) {
$data .= $this->read($len - $got);
}
*/
$factory = TStringFuncFactory::create();
while (($got = $factory->strlen($data)) < $len) {
$data .= $this->read($len - $got);
}
return $data;
}
> performance optimization
> ------------------------
>
> Key: THRIFT-3732
> URL: https://issues.apache.org/jira/browse/THRIFT-3732
> Project: Thrift
> Issue Type: Improvement
> Components: PHP - Library
> Reporter: jiang dongliang
>
> It's not necessary to get the instance inside the while loop.
> for example file TTransport.php
> public function readAll($len)
> {
> // return $this->read($len);
> $data = '';
> $got = 0;
> /** original
> while (($got = TStringFuncFactory::create()->strlen($data)) < $len) {
> $data .= $this->read($len - $got);
> }
> */
> $factory = TStringFuncFactory::create();
> while (($got = $factory->strlen($data)) < $len) {
> $data .= $this->read($len - $got);
> }
> return $data;
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)