Closed fusenuk closed 3 years ago
In the PHP code to pull the data from the SQL db you use code like
https://github.com/gchenuet/nest-datagraph/blob/master/frontend/php/getTemp.php#L14
$date_array = "Date(".date('Y', $phpdate).",".(date('n', $phpdate)-1).",".date('d', $phpdate).",".date('H', $phpdate).",".date('i', $phpdate).")";
which I just found out almost doubles the page load time when running this script on an old Raspberry Pi.
Changing the code to be
$nMinus = date('n', $phpdate)-1; $date_array = "Date(".date('Y,'.$nMinus.',d,H,i', $phpdate).")";
helps massively. it brought the total loading of JSON data for the energy.php page down from 11 seconds to 6 seconds.
Thanks for this issues. Could you please open a PR to fix it ? Thanks!
In the PHP code to pull the data from the SQL db you use code like
https://github.com/gchenuet/nest-datagraph/blob/master/frontend/php/getTemp.php#L14
which I just found out almost doubles the page load time when running this script on an old Raspberry Pi.
Changing the code to be
helps massively. it brought the total loading of JSON data for the energy.php page down from 11 seconds to 6 seconds.