A tool to benchmark and compare Pulsar-reported gas usage with actual CPU and memory consumption during contract execution.
npm run ts-node src/tools/benchmark_gas.ts <contractId> <method> <account> [args...]
import { benchmarkGas } from "../tools/benchmark_gas";
const result = await benchmarkGas({
contractId: "...",
method: "...",
args: [...],
account: "...",
});
cpuMs: CPU time in millisecondsmemDelta: Memory usage difference (bytes)pulsarGas: Gas reported by PulsarsimulationResult: Raw simulation resulterror: Any error encountered
npm test src/tools/benchmark_gas.test.ts
- Integrates with Pulsar toolsets and follows Stellar/Soroban best practices.
- Comprehensive error handling and diagnostics included.