0

I have a report generator function in my controller. At the end of the function I'm placed a

$before = microtime(true);

Then I'm working with this PHPExcel, setting the headers, the result, which is 140 lines of data in the xml.

$reporter->setResult($result)
    ->export(new ClientReport())
    ->save('php://output');

When I'm returning with the function, I'm using this line:

return microtime(true) - $before;

so, with these lines I'm measuring the runing time of the function, and I got 6.979903936386108 microsecounds as result of the function. However, when I check this in the web-browser's network inspector, then i got 7.5 secundum as result. With 400 lines of datas i got 26 sec, which have nothing to do with the time i'm measuring in the function. My question is: how is this possible, and how could I speed up this generating time? Because of this I can't generate a report with a little bit more datas, because it's so slow.

Random Dude
  • 872
  • 1
  • 9
  • 24
  • you can start showing the code to be optimized no? – Lelio Faieta Oct 24 '17 at 14:06
  • Actually it's way, way too long. But everything is between the $begin and the return microtime(true) - $before; lines. So if it's slow, then it should be in the result, right? Which is not even a lot of times. But the difference between the result in the return and in the network ispector is extremely different. Like the measured time is only some microsecounds, and in the network inspector it's always some secounds. – Random Dude Oct 24 '17 at 14:17
  • Slow connection? A client browser has no idea about the run time on the server, it only knows how long it took the results to be sent. – Dave S Oct 24 '17 at 16:11

0 Answers0