From e31b426a2dfaf42aaaa1c1acddf997edbedb468d Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 30 May 2021 02:55:57 -0500 Subject: [PATCH] stdscript: Add v0 treasury gen p2sh benchmark. BenchmarkIsTreasuryGenScriptHashScript -------------------------------------- v0_complex_non_standard 814816624 1.310 ns/op 0 allocs/op v0_treasury_generation_p2sh 520297904 2.274 ns/op 0 allocs/op This is part of a series of commits to fully implement the stdscript package. --- internal/staging/stdscript/script_bench_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/staging/stdscript/script_bench_test.go b/internal/staging/stdscript/script_bench_test.go index 0d168638..2192e65e 100644 --- a/internal/staging/stdscript/script_bench_test.go +++ b/internal/staging/stdscript/script_bench_test.go @@ -291,3 +291,13 @@ func BenchmarkIsTreasuryGenPubKeyHashScript(b *testing.B) { } benchIsX(b, filterFn, IsTreasuryGenPubKeyHashScript) } + +// BenchmarkIsTreasuryGenScriptHashScript benchmarks the performance of +// analyzing various public key scripts to determine if they are treasury +// generation p2sh scripts. +func BenchmarkIsTreasuryGenScriptHashScript(b *testing.B) { + filterFn := func(test scriptTest) bool { + return test.wantType == STTreasuryGenScriptHash + } + benchIsX(b, filterFn, IsTreasuryGenScriptHashScript) +}