EVM benchmark utilities#8944
Conversation
dvdplm
left a comment
There was a problem hiding this comment.
A few grumbles, mostly on docs/discoverability.
| use super::HookType; | ||
|
|
||
| /// Run chain jsontests on a given folder. | ||
| pub fn run_test_path<H: FnMut(&str, HookType)>(p: &Path, skip: &[&'static str], h: &mut H) { |
There was a problem hiding this comment.
There are 7 identical pub fn run_test_path added in this PR – would it be possible to avoid some boilerplate and have a single copy?
There was a problem hiding this comment.
Those functions are wrappers for the parent run_test_path function. Before none of them are exposed, but I figured it would be helpful to add them there, as it simplify library user's work to figure out how those functions are meant to be used.
They're not entirely identical -- the function parameter passed is different, determining which type of tests it operates on. But I'm open to any idea if we can make this better and avoid duplications. :)
| /// Indicate the type of the hook passed to test functions. | ||
| #[derive(Copy, Clone, Eq, PartialEq)] | ||
| pub enum HookType { | ||
| /// Hook passed on starting of a test. |
There was a problem hiding this comment.
Perhaps this is better? "Hook to code to run on test start"
| pub enum HookType { | ||
| /// Hook passed on starting of a test. | ||
| OnStart, | ||
| /// Hook passed on a test is finished. |
There was a problem hiding this comment.
Perhaps this is better? "Hook to code to run on test end"
| pub use ethereum_types::{H256, U256, Address}; | ||
|
|
||
| pub fn run_test_path(p: &Path, skip: &[&'static str], runner: fn (json_data: &[u8]) -> Vec<String>) { | ||
| /// Indicate the type of the hook passed to test functions. |
There was a problem hiding this comment.
Perhaps "Indicate when to run the hook passed to test functions."?
| --chain CHAIN Run only tests from specific chain. | ||
|
|
||
| Stats jsontests VM options: | ||
| --folder Run jsontest for a folder instead of a single file. |
There was a problem hiding this comment.
Could this not be inferred from the input path? If it's a file => run the file; if it's a folder => run all tests within?
| Usage: | ||
| parity-evm state-test <file> [--json --std-json --only NAME --chain CHAIN] | ||
| parity-evm stats [options] | ||
| parity-evm stats-jsontests-vm <file> [--folder] |
There was a problem hiding this comment.
The name of the command in itself does not seem sufficient to understand what this does. Not sure where the best place to put a proper description of what it does and what the output format is would be, but I think it'd be very useful.
| use std::collections::HashMap; | ||
| use std::time::{Instant, Duration}; | ||
|
|
||
| let file = args.arg_file.expect("FILE is required"); |
There was a problem hiding this comment.
"FILE (or PATH) is required"?
|
|
||
| let file = args.arg_file.expect("FILE is required"); | ||
|
|
||
| let mut times: HashMap<String, (Instant, Option<Duration>)> = HashMap::new(); |
There was a problem hiding this comment.
nitpick: I suggest calling this timings.
1200c22 to
a7d05b5
Compare
* master: EVM benchmark utilities (#8944)
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: parity: omit redundant last imported block number in light sync informant (openethereum#8962) Disable hardware-wallets on platforms that don't support `libusb` (openethereum#8464) Bump error-chain and quick_error versions (openethereum#8972) EVM benchmark utilities (openethereum#8944) parity: hide legacy options from cli --help (openethereum#8967) scripts: fix docker build tag on latest using master (openethereum#8952) Add type for passwords. (openethereum#8920)
rel #8914, #6744
Expose jsontests helpers from ethcore so that they can be used elsewhere. Allow hooking to start/stop point of each test so that time information can be recorded. Add a command in
evmbin:This runs executive standard jsontests against a specific folder/file, record the timing information, and then output them in tsv format. This would allow those benchmark info to be compared.
evmbin/bench.shis moved toscripts, and a new script is added, calledevm_jsontests_bench.sh, which runs the above command on all available vm jsontests.I also changed all scripts to use
/usr/bin/envinstead of/bin/bash. The later would mean it breaks on all non-FHS Linux systems (like NixOS).