Anyone know which is more efficient dynamic function execution
function push(
History storage self,
function(uint256, uint256) view returns (uint256) op,
uint256 delta
) internal returns (uint256, uint256) {
return push(self, op(latest(self), delta));
}
or using an enum
function push(
History storage self,
uint8 operation
uint256 delta
) internal returns (uint256, uint256) {
if(operation == 1) {
return push(self, latest(self) + delta);
}
return push(self, latest(self) - delta);
}