If you have looked at my articles on adding a sample based Grand Piano voice to Sonic Pi, then adding the following three lines to the programs immediately after the sam array is defined will improve performance. The lines use a loop to preload all the samples before the pieces start to play, and so they become immediately available when required to play a note.
sam.each do |s| load_sample s end
basically the loop iterates around the entries in the sam array, and takes the SECOND entry (offset 1) which is the name of the sample and uses the load_sample command to preload it into memory.
You can add this to all the programs in the article.