Start practicing far ahead before performances.
First I start with listening to recordings of the work. I want to have more reasonable expectations before I start playing a piece. At the beginning I always play very slow through a new piece. Slow enough to basically avoid any mistakes. If I do mess up, I focus right away on that spot to avoid learning bad technical habits.
Once a section is learned at a slow tempo, I start to work up to full tempo. The time frame dictates how long I can allow myself to work on certain details. If I have plenty of time to learn a section, I really focus on relaxation and good technique. I move the metronome up very slowly and I practice consistency through good physical habits.
If I have a very short time to learn a section I might have to start sacrificing a little bit of technique just to be able to get it up to tempo. Whenever this happens I know I haven’t left myself enough time to prepare, so I always try to plan my practicing pretty far ahead of the performances.
However it does happen, sometimes, that I will need to fill in for someone at the last minute. I might only have an hour to look at a part before playing a performance. In cases like this, I prioritize the most important challenging technical and solo passages and focus my practicing on them before playing the more “sight-readable” sections.
Isolate a specific problem in your technique.
My preferred method for learning difficult passages is to isolate a specific problem I find in my technique.
I slow down technical passages to actually notice what the problem is. If I am having trouble playing a passage at performance tempo, I will play it half the tempo or even slower. The speed will depend on what I think the problem might be. Once I understand what the problem is I decide what work needs to be done. For example, if my fingers are getting mixed up in a fast section with many notes, I will slow down until I find the specific note changes that are difficult. I will notice which specific sections of a run are difficult to keep steady even at slower tempos. I know that these sections will be throwing me off at full tempo.
Then I will isolate those specific note changes, sometimes literally just going back and forth over one interval. I will keep exploring the physical movements that need to happen in my technique to overcome the particular problem. Most often the solution is just finding a relaxed hand position that allows my fingers to move more efficiently and not forcing anything. Once a particular spot is learned in a slow tempo I will slowly integrate that detail back into the context of the whole run.
Even if I have only one or two days to learn a difficult passage, I will do the same process.
For any difficult passage my goal is to be prepared enough to be confident. For me that means being consistent and flexible. Practicing consistency gives you confidence in yourself. Practicing flexibility gives you extra confidence. It is very important to know that you can change something on the fly in a performance.