Can it be done at any time before the next salah begins (providing it isn't during a forbidden time), or should it be done as soon as possible?
Is it sunnah to pray as soon as you can, or fard/wajib?
Narrated/Authority of Ibn Umar said that Allah's Messenger,(SAW) said, "There lies in earliest time of Salah pleasure of Allah while the concluding time is His grant". Sunan at-Tirmidhi (Jami-al-Tirmidhi) Chapter No. 2, Salah (Prayers) Hadith No: 172
Narrated/Authority of Ali reported that the Prophet (SAW) said to him, "O Ali! Do not postpone three things: prayer when it is time for it, funeral when it is ready and the marriage of an unmarried woman when a suitable match is found. [Ahmed 828, Ibn e Majah 1486] Sunan at-Tirmidhi (Jami-al-Tirmidhi) Chapter No. 2, Salah (Prayers) Hadith No: 171
Narrated/Authority of Abu Amr Shaybani reported, that a man asked Sayyidina Ibn Mas'ud (RA), "Which deed was the best"? He said, "I had put the same question to Allah's Messenger (SAW) and he said, "To offer Salah during the mustahabb time for it." Then I asked him, what was besides that and he said that it was to serve parents. When I asked him about anything besides, he said it was to wage jihad in Allah's path." [Ahmed 4223, Bukhari 527, M85] Sunan at-Tirmidhi (Jami-al-Tirmidhi) Chapter No. 2, Salah (Prayers) Hadith No: 173
From the above Hadith, we see the essence of praying as soon as it is time for SAlah. It is highly recommended to pray as soon as you can but it is not Fard.
Allah knows the best.
Salah may be performed at anytime within its time limits, without incurring any sin.
As for the recommended (mustahab) time, there is some difference of opinion among the schools. In general, many hold the view that prayer should be hastened and performed at the beginning of the time, based on various ahadith such as:
سئل رسول الله صلى الله عليه وسلم أى الأعمال أفضل قال الصلاة في أول وقتها
The Messenger of Allah ﷺ was asked: 'Which actions are the best?' He said: "Prayer at its earliest time."
However some schools of thought consider it recommended to delay some of the prayers based on the following ahadith:
أسفروا بالفجر فإنه أعظم للأجر
Delay Fajr till whiteness for it fetches the maximum reward.
أبردوا بالظهر فإن شدة الحر من فيح جهنم
Pray Zuhr prayer when it becomes (a bit) cooler as the severity of heat is from the raging of the Hell-fire.
قدمنا على رسول الله صلى الله عليه وسلم المدينة فكان يؤخر العصر ما دامت الشمس بيضاء نقية
We came upon the Messenger of Allah (ﷺ) in Medina. He would postpone the 'Asr prayer as long as the sun remained white and clear.
لولا أن أشق على أمتي لأخرت العشاء إلى ثلث الليل أو نصفه
If it were not that it would be a hardship on my Ummah, then I would have ordered you to delay Isha until the third of the night, or its half.