php - How do you put 3 arrays in memory and then reference them to avoid hitting API calls more then 3 times -
in code have 3 functions nested. 1 calls 1 calls another. code execution slow. led believe because these api calls can contain lot of data , getting ran more once having impact on performance.
code sample follows:
$data['object'] = 'domain'; $data['action'] = 'read'; $data['format'] = 'json'; if($response = $this->request($data)){ $obj = json_decode($response,true); ....... } }else{ return $response; }
so basically, obj gets data.
can create private array in form , write results , run statements against instead of calling api several times?
i led believe because these api calls can contain lot of data , getting ran more once having impact on performance.
the golden rule of optimization do not optimize without measuring first. use profiler run code , tell code getting executed , taking longest time. if don't measure, speeding wrong thing.
in case, php, you'll want start xdebug.
once know being slow, can concern how speed things up.
Comments
Post a Comment