Hi guys, during the development of spark perps we care a lot about making it run stable and optimally and try to save gas. Can you please give some tips on how to make the app gas optimal?
The Sway compiler, still in its developmental phase, lacks extensive gas optimization. Either anticipate improvements in the compiler’s bytecode generation or simply write optimized assembly code for any notably inefficient segments.
And does the dividing to a few contracts have a big impact on the cost of gas
For example, I can make a code in one contract, or I can split it into 2 and call them in each other.
Will the cost of gas be very different with these approaches?
Accurately estimating gas costs without a dedicated gas estimation tool can be challenging. For instance, it’s important to note that external function calls typically incur higher gas costs compared to internal function calls. Additionally, we must consider the deployment costs associated with deploying multiple contracts, which can significantly impact the overall expense.
You can find the gas cost for each instruction in beta-4 here
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.