Page MenuHomePhabricator

D8835.diff
No OneTemporary

D8835.diff

diff --git a/src/bench/CMakeLists.txt b/src/bench/CMakeLists.txt
--- a/src/bench/CMakeLists.txt
+++ b/src/bench/CMakeLists.txt
@@ -60,6 +60,7 @@
rpc_blockchain.cpp
rpc_mempool.cpp
util_time.cpp
+ verify_script.cpp
# Add the generated headers to trigger the conversion command
${BENCH_DATA_GENERATED_HEADERS}
diff --git a/src/bench/verify_script.cpp b/src/bench/verify_script.cpp
new file mode 100644
--- /dev/null
+++ b/src/bench/verify_script.cpp
@@ -0,0 +1,41 @@
+// Copyright (c) 2016-2018 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <bench/bench.h>
+#include <key.h>
+#if defined(HAVE_CONSENSUS_LIB)
+#include <script/bitcoinconsensus.h>
+#endif
+#include <script/interpreter.h>
+#include <script/script.h>
+#include <script/script_error.h>
+#include <script/standard.h>
+#include <streams.h>
+#include <test/util/transaction_utils.h>
+
+#include <array>
+
+static void VerifyNestedIfScript(benchmark::State &state) {
+ std::vector<std::vector<uint8_t>> stack;
+ CScript script;
+ for (int i = 0; i < 100; ++i) {
+ script << OP_1 << OP_IF;
+ }
+ for (int i = 0; i < 1000; ++i) {
+ script << OP_1;
+ }
+ for (int i = 0; i < 100; ++i) {
+ script << OP_ENDIF;
+ }
+ while (state.KeepRunning()) {
+ auto stack_copy = stack;
+ ScriptExecutionMetrics metrics = {};
+ ScriptError error;
+ bool ret = EvalScript(stack_copy, script, 0, BaseSignatureChecker(),
+ metrics, &error);
+ assert(ret);
+ }
+}
+
+BENCHMARK(VerifyNestedIfScript, 100);

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 1, 11:56 (3 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187735
Default Alt Text
D8835.diff (1 KB)

Event Timeline