It is always a good idea to complete a proper warm up before your event. I'm going to break this down a bit.
Specificity is important. For example, if you're competing in an open water swimming event, then your warm up should consist primarily of swimming. Supplemental stretching and dynamic warming up are secondary activities (like arm swings, jumps, pretend swimming, jogging in place). Anytime your primary activity is unavailable, like at a course or venue that is closed until competition, you should engage in secondary activities.
Duration is inversely correlated to race distance. The longer the event is, the shorter your warm up should be. There have been a number of studies on the effects of various warm up routines. The general finding was that 15 minutes was the maximum needed to adequately prepare the muscles for the event. So if you're an elite runner warming up for a marathon, a 10 minute jog and then a couple light drills and strides should suffice. A new runner could jog in place for a couple of minutes and then use the first couple miles of the race itself to continue warming up. This has the added benefit of keeping pace under control in the opening miles.
On the other end of the spectrum, an elite athlete racing in a 5k or a sprint triathlon might spend 10-20 minutes running easy for the 5k, or 5-10 minutes on each leg of the triathlon warming up. Finishing with dynamic stretches (active stretching routines) and a few 20-30 second faster / high power pickups (with rest between) would be normal.
A newer athlete racing in a 5k should stick with 5-10 minutes easy running and a bit of dynamic stretching. A beginner triathlete might ride the bike for 5 minutes, jog for a couple of minutes, then head to the water for a few minutes to get comfortable.
In most of these situations, the warm up should conclude about 5 minutes before your race start. This is enough time for the heart rate to settle but not long enough for the muscles to start cooling down. The exception here are elite athletes who may want to keep their short high intensity efforts proximal to the race start.
There are many situations where a proper warm up becomes difficult or impossible. Think of the long corral lines at big marathons, or the time trial starts with closed swim courses at big triathlons. You can approach these situations in a couple of ways depending on your experience level. The first would be to complete a traditional warm up 1-2 hours prior, then re-warm up a few minutes prior to your start with whatever movements you can complete in your personal space. The second would be to skip the early traditional warm up and just do the dynamic warming up a few minutes prior.
Generally I'd recommend the more experienced / high level athletes get out and do the early warm up as their pace from the start of the event tends to be higher/harder. So even though the warm up was early, there will be some lasting effect. Newer athletes should use the first part of any big race to continue warming up so the dynamic stretching / moving in place a few minutes prior suffices.
Dynamic stretching is a catch all term for activities that both activate and stretch the muscles. Plyometric exercises are fast movements that engage explosive power. There is a bit of crossover between the two categories. Good examples of this are high knees, butt kicks, and height skips running drills. Exercises like box jumps and squat jumps are plyometrics that are less appropriate for a warm up unless your sport involves high explosive movement (like a 100m run).
Other dynamic stretches which you can do with limited space that are useful for running and triathlon are hip openers, toy soldier (leg kick), various skips, ankle hops (pretend jump rope), lunge walks, leg swings, arm circles, arm swings, and running in place.
There are individual considerations for warming up. Some athletes may simply feel better with a longer warm up. Some athletes may want to keep moving to keep a lid on their nerves. What theoretically works in the lab may not work for you in the real world. Use your less important events to play around a bit with your warm up routines to find dial in works best for you.
Marty Gaal, CSCS, is a USA Triathlon coach who lives in the Triangle area of North Carolina. Marty has been coaching endurance athletes since 2002. You can read more about OSB coaching services at www.osbmultisport.com.