diff --git a/package.json b/package.json index 4b306fb6..725f61b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "warp-contracts", - "version": "1.4.36-beta.5", + "version": "1.4.36-beta.6", "description": "An implementation of the SmartWeave smart contract protocol.", "types": "./lib/types/index.d.ts", "main": "./lib/cjs/index.js", diff --git a/src/contract/states/ContractInteractionState.ts b/src/contract/states/ContractInteractionState.ts index 027eeaf4..01168cf0 100644 --- a/src/contract/states/ContractInteractionState.ts +++ b/src/contract/states/ContractInteractionState.ts @@ -5,11 +5,14 @@ import { GQLNodeInterface } from '../../legacy/gqlResult'; import { Warp } from '../../core/Warp'; import { SortKeyCacheRangeOptions } from '../../cache/SortKeyCacheRangeOptions'; import { SimpleLRUCache } from '../../common/SimpleLRUCache'; +import { Benchmark } from '../../logging/Benchmark'; +import { LoggerFactory } from '../../logging/LoggerFactory'; export class ContractInteractionState implements InteractionState { private readonly _json = new Map>>(); private readonly _initialJson = new Map>(); private readonly _kv = new Map>(); + private readonly logger = LoggerFactory.INST.create('ContractInteractionState'); constructor(private readonly _warp: Warp) {} @@ -77,8 +80,14 @@ export class ContractInteractionState implements InteractionState { latestState.set(k, state.cachedValue); } }); - this.doStoreJson(latestState, interaction, forceStore).then(); + const doStoreJsonBenchmark = Benchmark.measure(); + await this.doStoreJson(latestState, interaction, forceStore); + doStoreJsonBenchmark.stop(); + this.logger.info('doStoreJsonBenchmark', doStoreJsonBenchmark.elapsed()); + const commitKvsBenchmark = Benchmark.measure(); await this.commitKVs(); + commitKvsBenchmark.stop(); + this.logger.info('commitKvs', doStoreJsonBenchmark.elapsed()); } finally { this.reset(); }