anchor.diff:  	for(var/id in cached_gases)
   		. += cached_gases[id][ARCHIVE] * cached_gases[id][GAS_META][META_GAS_SPECIFIC_HEAT]
   
  -/datum/gas_mixture/proc/total_moles() //moles
  -	var/list/cached_gases = gases
  -	. = 0
  -	for(var/id in cached_gases)
  -		. += cached_gases[id][MOLES]
  +//prefer this in performance critical areas
  +#define TOTAL_MOLES(cached_gases, out_var)\
  +	out_var = 0;\
  +	for(var/total_moles_id in cached_gases){\
  +		out_var += cached_gases[total_moles_id][MOLES];\
  +	}
  +
  +/datum/gas_mixture/proc/total_moles()
  +	var/cached_gases = gases
  +	TOTAL_MOLES(cached_gases, .)
   
   /datum/gas_mixture/proc/return_pressure() //kilopascals
   	if(volume > 0) // to prevent division by zero
  -		return total_moles() * R_IDEAL_GAS_EQUATION * temperature / volume
  +		var/cached_gases = gases
  +		TOTAL_MOLES(cached_gases, .)
  +		. *= R_IDEAL_GAS_EQUATION * temperature / volume
   	return 0
   
   /datum/gas_mixture/proc/return_temperature() //kelvins
  
positive.code: 			delta > gas_moles * MINIMUM_AIR_RATIO_TO_MOVE)
  			return id
  
  	if(total_moles() > MINIMUM_MOLES_DELTA_TO_MOVE)
  		var/temp
  		var/sample_temp
  
  
negative.code: 	return 1
  
  /datum/gas_mixture/remove(amount)
  	var/sum
  	var/list/cached_gases = gases
  	TOTAL_MOLES(cached_gases, sum)
  	amount = min(amount, sum) //Can not take more air than tile has!
  	if(amount <= 0)
  		return null
  	var/datum/gas_mixture/removed = new
  	var/list/removed_gases = removed.gases //accessing datum vars is slower than proc vars
  
  