From 1e6a30bb960fcc06d65998b79aaf32779015e58f Mon Sep 17 00:00:00 2001 From: Andreas Fackler Date: Fri, 6 Sep 2019 11:52:53 +0200 Subject: [PATCH] Revert `ethash` and submodule change and remove `evmbin` benches. The `ethhash` benches should be used with `--features bench`. The submodule update broke the tests. And the `evmbin` benches have been removed in `master`. --- ethash/src/lib.rs | 8 +++- ethcore/res/ethereum/tests | 2 +- ethcore/res/wasm-tests | 2 +- evmbin/benches-broken/mod.rs | 85 ------------------------------------ 4 files changed, 8 insertions(+), 89 deletions(-) delete mode 100644 evmbin/benches-broken/mod.rs diff --git a/ethash/src/lib.rs b/ethash/src/lib.rs index d99ee318f09..e40c08920cf 100644 --- a/ethash/src/lib.rs +++ b/ethash/src/lib.rs @@ -34,16 +34,20 @@ extern crate serde_json; #[cfg(test)] extern crate tempdir; -// TODO: This should be private; only needed for benches. +#[cfg(feature = "bench")] pub mod compute; +#[cfg(not(feature = "bench"))] +mod compute; mod seed_compute; mod cache; mod keccak; mod shared; -// TODO: This should be private; only needed for benches. +#[cfg(feature = "bench")] pub mod progpow; +#[cfg(not(feature = "bench"))] +mod progpow; pub use cache::{NodeCacheBuilder, OptimizeFor}; pub use compute::{ProofOfWork, quick_get_difficulty, slow_hash_block_number}; diff --git a/ethcore/res/ethereum/tests b/ethcore/res/ethereum/tests index d505c07e011..725dbc73a54 160000 --- a/ethcore/res/ethereum/tests +++ b/ethcore/res/ethereum/tests @@ -1 +1 @@ -Subproject commit d505c07e011ab8eb1b8d71ca4c550543a04aa0fc +Subproject commit 725dbc73a54649e22a00330bd0f4d6699a5060e5 diff --git a/ethcore/res/wasm-tests b/ethcore/res/wasm-tests index d17bfb69620..0edbf860ff7 160000 --- a/ethcore/res/wasm-tests +++ b/ethcore/res/wasm-tests @@ -1 +1 @@ -Subproject commit d17bfb6962041c4ac7f82eb79f72eef8d42f9447 +Subproject commit 0edbf860ff7ed4b6b6336097ba44836e8c6482dd diff --git a/evmbin/benches-broken/mod.rs b/evmbin/benches-broken/mod.rs deleted file mode 100644 index d8872b5100e..00000000000 --- a/evmbin/benches-broken/mod.rs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015-2019 Parity Technologies (UK) Ltd. -// This file is part of Parity Ethereum. - -// Parity Ethereum is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity Ethereum is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity Ethereum. If not, see . - -//! benchmarking for EVM -//! should be started with: -//! ```bash -//! multirust run nightly cargo bench -//! ``` - -#![feature(test)] - -extern crate test; -extern crate ethcore; -extern crate evm; -extern crate ethcore_util; -extern crate ethcore_bigint; -extern crate rustc_hex; - -use self::test::{Bencher, black_box}; - -use evm::run_vm; -use ethcore::vm::ActionParams; -use ethcore_bigint::prelude::U256; -use rustc_hex::FromHex; - -#[bench] -fn simple_loop_usize(b: &mut Bencher) { - simple_loop(U256::from(::std::usize::MAX), b) -} - -#[bench] -fn simple_loop_u256(b: &mut Bencher) { - simple_loop(!U256::zero(), b) -} - -fn simple_loop(gas: U256, b: &mut Bencher) { - let code = black_box( - "606060405260005b620042408112156019575b6001016007565b600081905550600680602b6000396000f3606060405200".from_hex().unwrap() - ); - - b.iter(|| { - let mut params = ActionParams::default(); - params.gas = gas; - params.code = Some(code.clone()); - - run_vm(params) - }); -} - -#[bench] -fn rng_usize(b: &mut Bencher) { - rng(U256::from(::std::usize::MAX), b) -} - -#[bench] -fn rng_u256(b: &mut Bencher) { - rng(!U256::zero(), b) -} - -fn rng(gas: U256, b: &mut Bencher) { - let code = black_box( - "6060604052600360056007600b60005b62004240811215607f5767ffe7649d5eca84179490940267f47ed85c4b9a6379019367f8e5dd9a5c994bba9390930267f91d87e4b8b74e55019267ff97f6f3b29cda529290920267f393ada8dd75c938019167fe8d437c45bb3735830267f47d9a7b5428ffec019150600101600f565b838518831882186000555050505050600680609a6000396000f3606060405200".from_hex().unwrap() - ); - - b.iter(|| { - let mut params = ActionParams::default(); - params.gas = gas; - params.code = Some(code.clone()); - - run_vm(params) - }); -}