For microcontrollers power consumption, thus heat, is generally most dependant on peripherals, clock and voltage. It is dependant a little bit on what instructions the CPU is performing, but it will be very hard to make any correlation. For example, I run a small test of a PIC16F690 (just applying power to the chip with internal FRC 8MHz oscillator) and measured the current consumption of these 2 main loops:
while(1);
0.783mA @ 3.3V no optimizer
uint8_t i = 0;
while(1) { i++; }
0.735mA @ 3.3V no optimizer
0.857mA @ 3.3V with optimizer
What I take from this is that the i++; instruction does consume more power than branching, but some other instructions may not (as the non optimized version has 2 bogus MOV instructions following the add). Therefore it's a highly empirical process in determining what calculation is really 'heavy' electrically as it's very architecture dependent.
Therefore, the following tips I can give are the opposite of what is applied for lower power consumption (e.g. battery operated devices):
1) Run the MCU at the highest clock speed & disable any sleep/idle systems (if applicable)
2) Run the MCU at the highest allowed voltage (like 3.6V)
3) Enable all peripherals at the highest clock possible
4) Have your GPIO system drive currents at the maximum current specification. The drivers of a microcontroller aren't that strong. At e.g. 4mA the output-high voltage may be down by as much as 0.3V or more. If you have 30 I/Os driving 4mA laods, it will add up to 36mW.
Obviously the worst-case is a GPIO short (e.g. 20mA short circuit current at 3.6V = 72mW), but that may not be realistic and damage the MCU or I/O pin at some point.
5) Increase ambient temperature as much as possible (e.g. the ambient temperature limit for your product). Generally electronics will consume more current at +85C than at +20C. The difference can easily be in the order of 10% across temperature range.
You may want to look up the specific electrical specs for your microcontroller. Many vendors will have very comprehensive details what affects power consumption, because generally you will want to look up those facts in order to lower the power consumption for battery applications.