The gas consumption of the protocol depends on the specific action executed and the user. Specifically, it might be higher whenever a user executes an action for the first time, or depending on how many currencies the user has deposited/borrowed. Every currency added to Aave Protocol slightly increases the gas cost of all the operations that involve checking the account global liquidity. The gas cost of the flashLoan() function also depends on the specific Flash Loan implementation.
The gas consumption estimations below are on top of the gas transfer costs of the underlying asset. I.e. some assets use more gas than others when transferring.
For internal calculations and to reduce the impact of rounding errors, the protocol uses the concept of Ray Math. A Ray is a unit with 27 decimals of precision. All the rates (liquidity/borrow/utilisation rates) as well as the cumulative indexes and the aTokens exchange rates are expressed in Ray.
Please refer to the following article for further details about this concept.