stdscript: Add v0 nulldata benchmark.

BenchmarkIsNullDataScript
-------------------------
v0_complex_non_standard          279362058   4.306 ns/op   0 allocs/op
v0_nulldata_no_data_push         276928082   4.325 ns/op   0 allocs/op
v0_nulldata_single_zero_push     40513850    29.47 ns/op   0 allocs/op
v0_nulldata_small_int_push       39842752    29.65 ns/op   0 allocs/op
v0_nulldata_max_small_int_push   36889138    29.82 ns/op   0 allocs/op
v0_nulldata_small_data_push      40597321    28.86 ns/op   0 allocs/op
v0_nulldata_60-byte_push         41307235    28.68 ns/op   0 allocs/op
v0_nulldata_max_standard_push    36347774    32.41 ns/op   0 allocs/op

This is part of a series of commits to fully implement the stdscript
package.
This commit is contained in:
Dave Collins 2021-05-30 02:55:37 -05:00
parent a6d266d0b9
commit bbaec90366
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2

View File

@ -184,3 +184,12 @@ func BenchmarkMultiSigRedeemScriptFromScriptSigV0(b *testing.B) {
})
}
}
// BenchmarkIsNullDataScript benchmarks the performance of analyzing various
// public key scripts to determine if they are nulldata scripts.
func BenchmarkIsNullDataScript(b *testing.B) {
filterFn := func(test scriptTest) bool {
return test.wantType == STNullData
}
benchIsX(b, filterFn, IsNullDataScript)
}