compression ratio + pump gas

All that octane chatter aside, dynamic compression ratio is the determining factor in what an engine’s octane needs will be. Cam profile dictates dynamic compression ratio. The more overlap in cam profile the lower dynamic compression will be, to correct for this static compression ratio must be raised.

This why a performance camshaft in another wise stock engine is a pig, and on the other hand a high compression ration with a stock camshaft produces copious pre-ignition, detonation, knock, or pinging.

One has to measure the existing volumes and dimensions of his engine, and use a dynamic compression calculator to properly design a good running engine.

Here a better explanation:
http://classicinlines.com/CompressionRatio.asp