At first, I thought it was because the date-based page was caching the results. I was wrong. It was merely faster overall.
I also added cache clearing support, which involved adding a new table (cache_clearing_dates).
Why is date.php faster than index.php?
If you compare the output of today’s commits (e.g. https://www.freshports.org/date.php?date=2016/4/3) with the home page, the output is the same, or at least it looks the same to me. I don’t see any differences.
Let’s examine the code.
date.php uses the Commits class (see line 113).
index.php uses the LatestCommits class (see line 159).
I suspect the difference is in there.
The SQL for the Commits class (used by date.php) is relatively easy to follow for someone with intermediate SQL skills. It’s about 60 lines.
I know what the code for LatestCommits (i.e. index.php) looks like; it is a juggernaut. It is deceiving. It’s a mere 10 lines long but there is much below the surface, and done mostly via stored procedures.
I think I will amend the Commits class to handle a date and a limit.