Halliday & Matthiessen (2014: 502-3 ):
There is the same difference between imperfective and perfective as with dependent clauses: other things being equal (that is, if occurring simply with their respective structure markers of and to), the imperfective is associated with the actual (e.g. the time of planting), the perfective with the potential, or virtual (e.g. the time to plant); sometimes the difference is minimal, as with the best way of finding out/the best way to find out – although even here can still be recognised. But the specific semantic force of the Head noun, or the conjunction or conjunctive preposition, will always dominate; e.g. the purpose of raising funds, the best occasion for trying out new methods.