For what it is worth - We had plenty of free time on our last layover at SJU so for the heck of it I timed the walk between the furthest gate in Terminal A to the furthest Gate in Terminal D. Walking at a leisurely pace it took me 16 minutes. On my way back to my starting point I walked at a brisk pace and it took about 11 minutes.
If you return through SJU when no big international flights are arriving you'll find Immigration and Customs to be very fast. I come in there at 11-11:30AM from another island, and have only the 4-6 people on my flight to contend with. I don't know at what time it might get busy though.