If you are really trying to get somewhere directly upwind in short period 10' waves, you will generally get there quickest simply motoring provided that you have a powerful engine. However, the motion will not be comfortable at all as you will be pitching quite a lot.
How well motorsailing works really depends on the boat. Some boats really benefit from having the sail area to induce a constant amount of heel although VMG going directly into the wind almost always suffers.
The way that I usually try to handle this situation is to fall off until I can really sail which essentially makes the wave period longer and when heeled, the boat will stiffen up some. Part of the key to this is getting the correct amount of sail area up. Overpowering is pretty obvious but I see a lot of people in this type of conditions underpowered which leads to greater rolling and often requires the engine to keep speed and steerage.
Probably the best thing to do is to try each method for 10 minutes and see what works best for the given conditions and boat.