Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3732

performance optimization

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • PHP - Library
    • None

    Description

      It's not necessary to get the instance inside the while loop.
      When transport a big data, the function calls up to 17,681 times.
      After the optimization, it's possible reducing to 125 times.
      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;
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            jdl13 jiang dongliang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: