Closed aslesarenko closed 4 years ago
This simple change will allow avoid constructing error messages for all validation checks when error doesn't happen (which is the main case).
E.g. the following Ergo code has many unnecessary string building operations.
validationState .validate(txDust, out.value >= BoxUtils.minimalErgoAmount(out, stateContext.currentParameters), s"$id, output ${Algos.encode(out.id)}, ${out.value} >= ${BoxUtils.minimalErgoAmount(out, stateContext.currentParameters)}") .validate(txFuture, out.creationHeight <= stateContext.currentHeight, s" ${out.creationHeight} <= ${stateContext.currentHeight} is not true, output id: $id: output $out") .validate(txBoxSize, out.bytes.length <= MaxBoxSize.value, s"$id: output $out") .validate(txBoxPropositionSize, out.propositionBytes.length <= MaxPropositionBytes.value, s"$id: output $out")
Coverage remained the same at 46.984% when pulling 7b92aabcf002285842d74942fcbe0fb3c26b3a8d on perf-optimizatons into ac24a650481bc6c5b90bfb61a997f2518effe718 on master.
This simple change will allow avoid constructing error messages for all validation checks when error doesn't happen (which is the main case).
E.g. the following Ergo code has many unnecessary string building operations.