Horsepower is the single best measure of internal combustion engine performance.
Power = (2 * pi * N * T)/33,000 in imperial units. 33000 is the unit conversion of 33000 ft-lb/min/hp.
This means it is torque times RPM times a conversion factor. In your example, the amount of work you can get out of either engine is exactly the same, since you can put gears on the back end to make it go however fast or slow that you want. Power will be the same.
There are real world gains to be made in driveablility based on the shape of the torque curve. Cars and motorcycles are easier to drive/ride if the engine has better torque at low rpm. But the fastest engines won't behave this way because you can design an engine for high rpm power or for driveability. There are ways to try to get both (multi-vane turbochargers, Honda's VTEC, variable inlet and outlet geometry) but they are all compromises. F1 engines are not built for driveability.
Torque is so much trouble, because it is so misunderstood. The reality is that for a given horsepower, you can get whatever torque you want via gearing. What torque ought to be proportional to is acceleration (it's the F in F=ma). But torque is based on gears. The latest versions of US diesel pickups are in a "torque war," so one might think that having 1000 ft-pounds of torque in an engine means it's actually a really fast vehicle, but it isn't. These diesel engines run at a low rpm, so the gears required to run on the highway mean the trucks are slower than gas engines with less than half the torque. While the combination of power and torque and the rpm values of each peak can be useful to those who know how to interpret them well, my opinion is that torque is more of a marketing thing than an actual descriptor of engine performance.