The first part is to figure out the notes. The second part is to figure out the easiest way to play the part (fingering and shifts). Sometimes this does not happen till later. The third part is to play it in till it's easy.
If you can't play something at tempo, you slow it down to whatever tempo allows you to play it. Then you play it over in over until you can play it a little faster. Hopefully over repeated sessions you can get it fast enough. If this does not happen before the gig, you simplify or make up something else that fits. If you suspect you won't be able to master the part in time, work up an alternate version sooner rather than later. There were many times where I performed a passage before I mastered it and had to simplify.
The weird thing is there are also many times when I remember looking at the music a few weeks after the gig and being able to play the part. My theory is we develop mental blocks that can frustrate our ability to perform tasks. After taking a break and allowing our mind to relax, the mental block dissipates.
In order to try and avoid developing mental blocks, I tend to practice several passages in a rotation. I work one passage up until I hit the wall where further progress seems impossible. Before getting too frustrated, I put set the passage aside and work on something else.
When you start working on a passage, expect to start slower than you ended on the last session. Then try to work it up to a faster temp. Hopefully when you hit wall again, you will have mastered playing it slightly faster than the last time. It's sort of like 1 step back 2 steps forward.