Not looked in great detail, but you are doing a lot of cos and sin operations which could be very very slow. I would cache those - you probably only have 60 different numbers to cache which will save a huge amount of on the fly calculation.
Have an array of 60 items for each of cos and sin (and perhaps radians), and fill it up front with the 60 results you need. Then use the array instead of doing the calculations each time.
Check out this link as well. viewtopic.php?t=320014
EDIT. There is a huge amount more caching you could do - for example, the entire set of coordindates for both minute, second and hours hands could be in caches. It's only 60 * 3 entries of start and end coordinates of the lines.
Have an array of 60 items for each of cos and sin (and perhaps radians), and fill it up front with the 60 results you need. Then use the array instead of doing the calculations each time.
Check out this link as well. viewtopic.php?t=320014
EDIT. There is a huge amount more caching you could do - for example, the entire set of coordindates for both minute, second and hours hands could be in caches. It's only 60 * 3 entries of start and end coordinates of the lines.
Statistics: Posted by jamesh — Thu Aug 07, 2025 12:15 pm