That's not technically correct. Ideally, the best time to shift is when the next gear up will provide more drive than the previous gear.
Sport rider has an excellent
article on shift points and power.
The short answer is that while horsepower is the best way to measure the peak power of an engine, ultimately acceleration is about how much torque is being delivered to the rear wheel. Rear wheel torque can be measured in foot pounds, just like engine torque. However, unlike engine torque, rear wheel torque is greatly effected by the transmission. An engine that produces a lot of horsepower but not much torque can be geared much lower than an engine that produces a lot of torque but not much horsepower. For any two given engines, the engine with higher peak horsepower can always be geared to provide more rear wheel torque.
When actually calculating rear wheel torque, you need to use the torque dyno graph from the engine, and compare that to your gearing, from engine through to the rubber. As we know, peak torque usually falls off before peak horsepower. However, because a lower gear provides more power to the rear wheel than a taller gear, it usually makes sense to stay in the same gear well past this point. Eventually torque falls off so much that shifting up a gear will actually provide more thrust at the than staying in the current gear. The steep part of this descent often happens near peak horsepower output, but not always.
On most bikes, maximum acceleration occurs by redlining first and second gear, then shifting progressively closer to the torque drop off point in each subsequent gear.
Of course, it depends heavily on the bike. A 600cc sport bike rider will usually do well to shift near redline in the first 4 gears. A 1000 rider will usually benefit from redlining almost every gear (liter bikes use tall gearing, often good for 100mph in first.) My BMW R1150R Rockster seems to prefer short shifting, often 1-2K before red line (at about 6K RPM.) The Rockster has both a torquey engine, and a short ratio gearbox.
Side notes: It's best not to hit the rev-limiter on any bike; avoid it if at all possible, because it sure as hell isn't a shift warning. Besides being bad for the bike, it usually doesn't provide a lot of power. Also remember that shifting isn't nearly as important as proper line selection. It's better to be off by 500-1000RPMs than it is to waste attention needed for other tasks.