The size of crystals in igneous rocks is dependent on the rate of cooling of magma as rocks crystallise. For example, gabbro has larger grains so the rate of cooling is very slow over many years (in a magma chamber), dolerite has medium grains so the rate is slow , over months (so formed in dykes/sills), basalt has very fine grains so the magma cooled very quickly over only days (in lava flows on the surface).