What is the reason for the ~1300 extra gas on by calling B & E compared to D?
Above each method is the gas cost when called directly.
pragma solidity ^0.8.0;
contract A{
// 23620 gas
function B () public returns (bytes memory) {
(bool success, bytes memory data) =
address(this).call(abi.encodeWithSignature("C(uint256)",92) );
return data;
}
// 22000 gas
function C (uint256 c) public returns (uint256){
return 5 + c;
}
// 22070 gas
function D (uint256 d) public returns (uint256){
C(d);
return d;
}
//23277 gas
function E (uint256 d) public returns (uint256){
this.C(d);
return d;
}
}
Is there any way to variably call a function within a given contract variably with similar gas costs to function D?