chore(benches): update benchmark data to new format (#559)

* feat(aquavm-air-cli): `run` fails if AquaVM fails
Unless `run --no-fail` is provided.  It will make benchmarks fail
on errors, unless you provide `--no-fail` to specific benchmark.

* Fix dashboard and network_explore benches
* Convert benchmark data to new format
* `performance_metering`: use dirs only

Ordinary files like README.md are not considered to be a benchmark.

* Update `benches/performance_metering/README.md`

* Fix performance report

Looks like performance reports was merged in wrong order: data is not
sorted by machine ID.  The sorting is needed for stable diffs.

* Run benchmarks on Macbook Air M1
This commit is contained in:
Ivan Boldyrev 2023-04-11 02:27:32 +07:00 committed by GitHub
parent 499ee82903
commit d155bc7610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 4531 additions and 568 deletions

4
Cargo.lock generated
View File

@ -2040,9 +2040,9 @@ dependencies = [
[[package]]
name = "marine-wasmtime-backend"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a8aeb3e06867363bd177dba64dee12b2166343bcf917a4d1b322e577d4f65a5"
checksum = "a46d7fc11c8e16f6a2a1c4f88f1389ad2eb2e0379a8bc536ba3264f3dbaf6fe1"
dependencies = [
"anyhow",
"it-memory-traits",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,303 +1,4 @@
{
"0dfa4f098d7a6ef0d77a7bbc028ccf65fd6dc8d37be8a466ab3933a1a4a8e113": {
"benches": {
"big_values_data": {
"comment": "Loading a trace with huge values",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "14.17ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "6.08ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "6.00ms",
"nested": {
"to_vec(call_results)": "17.00µs",
"to_vec(data)": "4.95ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "7.87ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "40.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "7.61ms",
"air_parser::parser::air_parser::parse": "66.00µs"
}
},
"runner::execute": "18.00µs"
}
}
},
"total_time": "14.17ms"
},
"dashboard": {
"comment": "big dashboard test",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "89.32ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "469.00µs",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "415.00µs",
"nested": {
"to_vec(call_results)": "33.00µs",
"to_vec(data)": "215.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "1.06ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "56.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "589.00µs",
"air_parser::parser::air_parser::parse": "233.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "87.58ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "78.38ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step",
"duration": "7.91ms",
"nested": {
"instructions::call::resolved_call::prepare_request_params": {
"common_prefix": "air::execution_step",
"duration": "678.00µs",
"nested": {
"instructions::call::resolved_call::serde_json::to_string(tetraplets)": "36.00µs",
"resolver::resolve::resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "416.00µs",
"nested": {
"resolve_variable": "131.00µs"
}
}
}
},
"resolver::resolve::resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.09ms",
"nested": {
"resolve_variable": "362.00µs"
}
}
}
},
"new": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "50.99ms",
"nested": {
"resolve_ast_scalar": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "37.72ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "23.15ms",
"nested": {
"resolve_variable": "7.40ms"
}
}
}
}
}
}
}
}
}
}
}
}
},
"total_time": "89.32ms"
},
"long_data": {
"comment": "Long data trace",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "4.44ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "1.32ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "1.24ms",
"nested": {
"to_vec(call_results)": "23.00µs",
"to_vec(data)": "672.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "2.88ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "64.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "2.59ms",
"air_parser::parser::air_parser::parse": "63.00µs"
}
},
"runner::execute": "22.00µs"
}
}
},
"total_time": "4.44ms"
},
"network_explore": {
"comment": "5 peers of network are discovered",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "8.09ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "256.00µs",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "198.00µs",
"nested": {
"to_vec(call_results)": "21.00µs",
"to_vec(data)": "62.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "661.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "60.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "244.00µs",
"air_parser::parser::air_parser::parse": "174.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "6.94ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "6.12ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.02ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "393.00µs",
"nested": {
"resolve_variable": "124.00µs"
}
}
}
},
"new": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "3.57ms",
"nested": {
"resolve_ast_scalar": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "2.61ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.60ms",
"nested": {
"resolve_variable": "517.00µs"
}
}
}
}
}
}
}
}
}
}
}
}
},
"total_time": "8.09ms"
},
"parser_10000_100": {
"comment": "Running very long AIR script with lot of variables and assignments",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "32.25ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "202.00µs",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "152.00µs",
"nested": {
"to_vec(call_results)": "17.00µs",
"to_vec(data)": "45.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "29.95ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "49.00µs",
"air_parser::parser::air_parser::parse": "29.74ms"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "264.00µs",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "169.00µs",
"nested": {
"execute": "29.00µs",
"new": "40.00µs"
}
}
}
}
}
}
},
"total_time": "32.25ms"
}
},
"datetime": "2023-02-14 04:31:01.303450+00:00",
"platform": "macOS-11.7.3-x86_64-i386-64bit",
"version": "0.35.1"
},
"05b76e53f793eceba4cb1e947eecaedf581b236317d6c24d5fba40ce9350735f": {
"benches": {
"big_values_data": {
@ -597,6 +298,305 @@
"platform": "Linux-5.10.136-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.36",
"version": "0.35.1"
},
"0dfa4f098d7a6ef0d77a7bbc028ccf65fd6dc8d37be8a466ab3933a1a4a8e113": {
"benches": {
"big_values_data": {
"comment": "Loading a trace with huge values",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "14.17ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "6.08ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "6.00ms",
"nested": {
"to_vec(call_results)": "17.00µs",
"to_vec(data)": "4.95ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "7.87ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "40.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "7.61ms",
"air_parser::parser::air_parser::parse": "66.00µs"
}
},
"runner::execute": "18.00µs"
}
}
},
"total_time": "14.17ms"
},
"dashboard": {
"comment": "big dashboard test",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "89.32ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "469.00µs",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "415.00µs",
"nested": {
"to_vec(call_results)": "33.00µs",
"to_vec(data)": "215.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "1.06ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "56.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "589.00µs",
"air_parser::parser::air_parser::parse": "233.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "87.58ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "78.38ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step",
"duration": "7.91ms",
"nested": {
"instructions::call::resolved_call::prepare_request_params": {
"common_prefix": "air::execution_step",
"duration": "678.00µs",
"nested": {
"instructions::call::resolved_call::serde_json::to_string(tetraplets)": "36.00µs",
"resolver::resolve::resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "416.00µs",
"nested": {
"resolve_variable": "131.00µs"
}
}
}
},
"resolver::resolve::resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.09ms",
"nested": {
"resolve_variable": "362.00µs"
}
}
}
},
"new": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "50.99ms",
"nested": {
"resolve_ast_scalar": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "37.72ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "23.15ms",
"nested": {
"resolve_variable": "7.40ms"
}
}
}
}
}
}
}
}
}
}
}
}
},
"total_time": "89.32ms"
},
"long_data": {
"comment": "Long data trace",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "4.44ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "1.32ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "1.24ms",
"nested": {
"to_vec(call_results)": "23.00µs",
"to_vec(data)": "672.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "2.88ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "64.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "2.59ms",
"air_parser::parser::air_parser::parse": "63.00µs"
}
},
"runner::execute": "22.00µs"
}
}
},
"total_time": "4.44ms"
},
"network_explore": {
"comment": "5 peers of network are discovered",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "8.09ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "256.00µs",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "198.00µs",
"nested": {
"to_vec(call_results)": "21.00µs",
"to_vec(data)": "62.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "661.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "60.00µs",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "244.00µs",
"air_parser::parser::air_parser::parse": "174.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "6.94ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "6.12ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.02ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "393.00µs",
"nested": {
"resolve_variable": "124.00µs"
}
}
}
},
"new": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "3.57ms",
"nested": {
"resolve_ast_scalar": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "2.61ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.60ms",
"nested": {
"resolve_variable": "517.00µs"
}
}
}
}
}
}
}
}
}
}
}
}
},
"total_time": "8.09ms"
},
"parser_10000_100": {
"comment": "Running very long AIR script with lot of variables and assignments",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "32.25ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "202.00µs",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "152.00µs",
"nested": {
"to_vec(call_results)": "17.00µs",
"to_vec(data)": "45.00µs"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "29.95ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "49.00µs",
"air_parser::parser::air_parser::parse": "29.74ms"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "264.00µs",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "169.00µs",
"nested": {
"execute": "29.00µs",
"new": "40.00µs"
}
}
}
}
}
}
},
"total_time": "32.25ms"
}
},
"datetime": "2023-02-14 04:31:01.303450+00:00",
"platform": "macOS-11.7.3-x86_64-i386-64bit",
"version": "0.35.1"
},
"5fce753d17dde8b439ef04cdbce135789eb44646c753548ad79a37b88cf17f0a": {
"benches": {
"big_values_data": {
@ -1501,115 +1501,115 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "31.11ms",
"duration": "34.61ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "9.24ms",
"duration": "10.10ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "7.66ms",
"duration": "8.30ms",
"nested": {
"to_vec(call_results)": "95.00µs",
"to_vec(data)": "4.74ms"
"to_vec(call_results)": "106.00µs",
"to_vec(data)": "5.04ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "17.66ms",
"duration": "20.83ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "1.42ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "11.20ms",
"air_parser::parser::air_parser::parse": "1.73ms"
"air::preparation_step::preparation::make_exec_ctx": "1.56ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "13.87ms",
"air_parser::parser::air_parser::parse": "2.05ms"
}
},
"runner::execute": "126.00µs"
}
}
},
"total_time": "31.11ms"
"total_time": "34.61ms"
},
"dashboard": {
"comment": "big dashboard test",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "103.30ms",
"duration": "108.80ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "4.26ms",
"duration": "4.55ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "3.49ms",
"duration": "3.67ms",
"nested": {
"to_vec(call_results)": "127.00µs",
"to_vec(data)": "1.73ms"
"to_vec(call_results)": "129.00µs",
"to_vec(data)": "2.05ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "16.36ms",
"duration": "19.65ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "1.63ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "5.79ms",
"air_parser::parser::air_parser::parse": "5.98ms"
"air::preparation_step::preparation::make_exec_ctx": "2.13ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "8.52ms",
"air_parser::parser::air_parser::parse": "6.38ms"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "78.79ms",
"duration": "80.74ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "66.87ms",
"duration": "68.82ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step",
"duration": "9.53ms",
"duration": "12.66ms",
"nested": {
"instructions::call::resolved_call::prepare_request_params": {
"common_prefix": "air::execution_step",
"duration": "1.49ms",
"duration": "1.14ms",
"nested": {
"instructions::call::resolved_call::serde_json::to_string(tetraplets)": "326.00µs",
"instructions::call::resolved_call::serde_json::to_string(tetraplets)": "187.00µs",
"resolver::resolve::resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "316.00µs",
"duration": "309.00µs",
"nested": {
"resolve_variable": "100.00µs"
"resolve_variable": "95.00µs"
}
}
}
},
"resolver::resolve::resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "922.00µs",
"duration": "891.00µs",
"nested": {
"resolve_variable": "264.00µs"
"resolve_variable": "258.00µs"
}
}
}
},
"new": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "41.00ms",
"duration": "39.46ms",
"nested": {
"resolve_ast_scalar": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "29.92ms",
"duration": "28.76ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "18.44ms",
"duration": "17.71ms",
"nested": {
"resolve_variable": "5.83ms"
"resolve_variable": "5.49ms"
}
}
}
@ -1623,108 +1623,108 @@
}
}
},
"total_time": "103.30ms"
"total_time": "108.80ms"
},
"long_data": {
"comment": "Long data trace",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "24.19ms",
"duration": "25.93ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "6.36ms",
"duration": "6.53ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "4.77ms",
"duration": "4.85ms",
"nested": {
"to_vec(call_results)": "98.00µs",
"to_vec(data)": "2.14ms"
"to_vec(call_results)": "92.00µs",
"to_vec(data)": "2.27ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "13.75ms",
"duration": "15.86ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "1.73ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "7.07ms",
"air_parser::parser::air_parser::parse": "1.73ms"
"air::preparation_step::preparation::make_exec_ctx": "2.14ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "9.17ms",
"air_parser::parser::air_parser::parse": "1.90ms"
}
},
"runner::execute": "127.00µs"
"runner::execute": "121.00µs"
}
}
},
"total_time": "24.19ms"
"total_time": "25.93ms"
},
"network_explore": {
"comment": "5 peers of network are discovered",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "45.66ms",
"duration": "47.20ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "4.96ms",
"duration": "4.91ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "4.20ms",
"duration": "4.09ms",
"nested": {
"to_vec(call_results)": "94.00µs",
"to_vec(data)": "2.09ms"
"to_vec(call_results)": "90.00µs",
"to_vec(data)": "2.16ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "19.04ms",
"duration": "20.07ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "2.10ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "7.41ms",
"air_parser::parser::air_parser::parse": "6.61ms"
"air::preparation_step::preparation::make_exec_ctx": "2.25ms",
"air_interpreter_data::interpreter_data::serde_json::from_slice": "8.97ms",
"air_parser::parser::air_parser::parse": "6.48ms"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "17.54ms",
"duration": "18.57ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "10.17ms",
"duration": "11.50ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "3.47ms",
"duration": "5.08ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "544.00µs",
"duration": "333.00µs",
"nested": {
"resolve_variable": "96.00µs"
"resolve_variable": "92.00µs"
}
}
}
},
"new": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "4.49ms",
"duration": "3.96ms",
"nested": {
"resolve_ast_scalar": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "2.94ms",
"duration": "2.54ms",
"nested": {
"resolve_ast_variable": {
"common_prefix": "air::execution_step::resolver::resolve",
"duration": "1.76ms",
"duration": "1.71ms",
"nested": {
"resolve_variable": "537.00µs"
"resolve_variable": "442.00µs"
}
}
}
@ -1738,47 +1738,47 @@
}
}
},
"total_time": "45.66ms"
"total_time": "47.20ms"
},
"parser_10000_100": {
"comment": "Running very long AIR script with lot of variables and assignments",
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "46.91ms",
"duration": "46.04ms",
"nested": {
"farewell_step::outcome::from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "4.02ms",
"duration": "3.87ms",
"nested": {
"populate_outcome_from_contexts": {
"common_prefix": "air::farewell_step::outcome::serde_json",
"duration": "3.32ms",
"duration": "3.00ms",
"nested": {
"to_vec(call_results)": "97.00µs",
"to_vec(data)": "1.50ms"
"to_vec(call_results)": "92.00µs",
"to_vec(data)": "1.56ms"
}
}
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "33.50ms",
"duration": "31.76ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "1.45ms",
"air_parser::parser::air_parser::parse": "28.97ms"
"air::preparation_step::preparation::make_exec_ctx": "1.46ms",
"air_parser::parser::air_parser::parse": "27.38ms"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call",
"duration": "4.27ms",
"duration": "6.19ms",
"nested": {
"execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call",
"duration": "2.07ms",
"duration": "4.02ms",
"nested": {
"execute": "431.00µs",
"new": "475.00µs"
"execute": "2.42ms",
"new": "435.00µs"
}
}
}
@ -1786,11 +1786,11 @@
}
}
},
"total_time": "46.91ms"
"total_time": "46.04ms"
}
},
"datetime": "2023-02-14 11:51:40.780024+00:00",
"platform": "macOS-13.1-arm64-arm-64bit",
"version": "0.35.1"
"datetime": "2023-03-29 16:46:52.960987+00:00",
"platform": "macOS-13.2.1-arm64-arm-64bit",
"version": "0.39.0"
}
}

View File

@ -1,85 +1,3 @@
Machine 0dfa4f098d7a6ef0d77a7bbc028ccf65fd6dc8d37be8a466ab3933a1a4a8e113:
Platform: macOS-11.7.3-x86_64-i386-64bit
Timestamp: 2023-02-14 04:31:01.303450+00:00
AquaVM version: 0.35.1
Benches:
big_values_data (14.17ms): Loading a trace with huge values
air::runner::execute_air: 14.17ms
farewell_step::outcome::from_success_result: 6.08ms
populate_outcome_from_contexts: 6.00ms
to_vec(call_results): 17.00µs
to_vec(data): 4.95ms
preparation_step::preparation::prepare: 7.87ms
air::preparation_step::preparation::make_exec_ctx: 40.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 7.61ms
air_parser::parser::air_parser::parse: 66.00µs
runner::execute: 18.00µs
dashboard (89.32ms): big dashboard test
air::runner::execute_air: 89.32ms
farewell_step::outcome::from_success_result: 469.00µs
populate_outcome_from_contexts: 415.00µs
to_vec(call_results): 33.00µs
to_vec(data): 215.00µs
preparation_step::preparation::prepare: 1.06ms
air::preparation_step::preparation::make_exec_ctx: 56.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 589.00µs
air_parser::parser::air_parser::parse: 233.00µs
runner::execute: 87.58ms
execute: 78.38ms
execute: 7.91ms
instructions::call::resolved_call::prepare_request_params: 678.00µs
instructions::call::resolved_call::serde_json::to_string(tetraplets): 36.00µs
resolver::resolve::resolve_ast_variable: 416.00µs
resolve_variable: 131.00µs
resolver::resolve::resolve_ast_variable: 1.09ms
resolve_variable: 362.00µs
new: 50.99ms
resolve_ast_scalar: 37.72ms
resolve_ast_variable: 23.15ms
resolve_variable: 7.40ms
long_data (4.44ms): Long data trace
air::runner::execute_air: 4.44ms
farewell_step::outcome::from_success_result: 1.32ms
populate_outcome_from_contexts: 1.24ms
to_vec(call_results): 23.00µs
to_vec(data): 672.00µs
preparation_step::preparation::prepare: 2.88ms
air::preparation_step::preparation::make_exec_ctx: 64.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 2.59ms
air_parser::parser::air_parser::parse: 63.00µs
runner::execute: 22.00µs
network_explore (8.09ms): 5 peers of network are discovered
air::runner::execute_air: 8.09ms
farewell_step::outcome::from_success_result: 256.00µs
populate_outcome_from_contexts: 198.00µs
to_vec(call_results): 21.00µs
to_vec(data): 62.00µs
preparation_step::preparation::prepare: 661.00µs
air::preparation_step::preparation::make_exec_ctx: 60.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 244.00µs
air_parser::parser::air_parser::parse: 174.00µs
runner::execute: 6.94ms
execute: 6.12ms
execute: 1.02ms
resolve_ast_variable: 393.00µs
resolve_variable: 124.00µs
new: 3.57ms
resolve_ast_scalar: 2.61ms
resolve_ast_variable: 1.60ms
resolve_variable: 517.00µs
parser_10000_100 (32.25ms): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 32.25ms
farewell_step::outcome::from_success_result: 202.00µs
populate_outcome_from_contexts: 152.00µs
to_vec(call_results): 17.00µs
to_vec(data): 45.00µs
preparation_step::preparation::prepare: 29.95ms
air::preparation_step::preparation::make_exec_ctx: 49.00µs
air_parser::parser::air_parser::parse: 29.74ms
runner::execute: 264.00µs
execute: 169.00µs
execute: 29.00µs
new: 40.00µs
Machine 05b76e53f793eceba4cb1e947eecaedf581b236317d6c24d5fba40ce9350735f:
Platform: Linux-5.10.136-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.36
Timestamp: 2023-02-14 07:53:57.703442+00:00
@ -162,6 +80,88 @@ Machine 05b76e53f793eceba4cb1e947eecaedf581b236317d6c24d5fba40ce9350735f:
execute: 65.00µs
execute: 11.00µs
new: 13.00µs
Machine 0dfa4f098d7a6ef0d77a7bbc028ccf65fd6dc8d37be8a466ab3933a1a4a8e113:
Platform: macOS-11.7.3-x86_64-i386-64bit
Timestamp: 2023-02-14 04:31:01.303450+00:00
AquaVM version: 0.35.1
Benches:
big_values_data (14.17ms): Loading a trace with huge values
air::runner::execute_air: 14.17ms
farewell_step::outcome::from_success_result: 6.08ms
populate_outcome_from_contexts: 6.00ms
to_vec(call_results): 17.00µs
to_vec(data): 4.95ms
preparation_step::preparation::prepare: 7.87ms
air::preparation_step::preparation::make_exec_ctx: 40.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 7.61ms
air_parser::parser::air_parser::parse: 66.00µs
runner::execute: 18.00µs
dashboard (89.32ms): big dashboard test
air::runner::execute_air: 89.32ms
farewell_step::outcome::from_success_result: 469.00µs
populate_outcome_from_contexts: 415.00µs
to_vec(call_results): 33.00µs
to_vec(data): 215.00µs
preparation_step::preparation::prepare: 1.06ms
air::preparation_step::preparation::make_exec_ctx: 56.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 589.00µs
air_parser::parser::air_parser::parse: 233.00µs
runner::execute: 87.58ms
execute: 78.38ms
execute: 7.91ms
instructions::call::resolved_call::prepare_request_params: 678.00µs
instructions::call::resolved_call::serde_json::to_string(tetraplets): 36.00µs
resolver::resolve::resolve_ast_variable: 416.00µs
resolve_variable: 131.00µs
resolver::resolve::resolve_ast_variable: 1.09ms
resolve_variable: 362.00µs
new: 50.99ms
resolve_ast_scalar: 37.72ms
resolve_ast_variable: 23.15ms
resolve_variable: 7.40ms
long_data (4.44ms): Long data trace
air::runner::execute_air: 4.44ms
farewell_step::outcome::from_success_result: 1.32ms
populate_outcome_from_contexts: 1.24ms
to_vec(call_results): 23.00µs
to_vec(data): 672.00µs
preparation_step::preparation::prepare: 2.88ms
air::preparation_step::preparation::make_exec_ctx: 64.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 2.59ms
air_parser::parser::air_parser::parse: 63.00µs
runner::execute: 22.00µs
network_explore (8.09ms): 5 peers of network are discovered
air::runner::execute_air: 8.09ms
farewell_step::outcome::from_success_result: 256.00µs
populate_outcome_from_contexts: 198.00µs
to_vec(call_results): 21.00µs
to_vec(data): 62.00µs
preparation_step::preparation::prepare: 661.00µs
air::preparation_step::preparation::make_exec_ctx: 60.00µs
air_interpreter_data::interpreter_data::serde_json::from_slice: 244.00µs
air_parser::parser::air_parser::parse: 174.00µs
runner::execute: 6.94ms
execute: 6.12ms
execute: 1.02ms
resolve_ast_variable: 393.00µs
resolve_variable: 124.00µs
new: 3.57ms
resolve_ast_scalar: 2.61ms
resolve_ast_variable: 1.60ms
resolve_variable: 517.00µs
parser_10000_100 (32.25ms): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 32.25ms
farewell_step::outcome::from_success_result: 202.00µs
populate_outcome_from_contexts: 152.00µs
to_vec(call_results): 17.00µs
to_vec(data): 45.00µs
preparation_step::preparation::prepare: 29.95ms
air::preparation_step::preparation::make_exec_ctx: 49.00µs
air_parser::parser::air_parser::parse: 29.74ms
runner::execute: 264.00µs
execute: 169.00µs
execute: 29.00µs
new: 40.00µs
Machine 5fce753d17dde8b439ef04cdbce135789eb44646c753548ad79a37b88cf17f0a:
Platform: macOS-12.3.1-arm64-arm-64bit
Timestamp: 2023-02-13 16:59:20.507375+00:00
@ -409,84 +409,84 @@ Machine c1f3ea5950db0a10b44da931c25774d64ab25084f47d504f72f311e694550ff1:
execute: 29.00µs
new: 38.00µs
Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f:
Platform: macOS-13.1-arm64-arm-64bit
Timestamp: 2023-02-14 11:51:40.780024+00:00
AquaVM version: 0.35.1
Platform: macOS-13.2.1-arm64-arm-64bit
Timestamp: 2023-03-29 16:46:52.960987+00:00
AquaVM version: 0.39.0
Benches:
big_values_data (31.11ms): Loading a trace with huge values
air::runner::execute_air: 31.11ms
farewell_step::outcome::from_success_result: 9.24ms
populate_outcome_from_contexts: 7.66ms
to_vec(call_results): 95.00µs
to_vec(data): 4.74ms
preparation_step::preparation::prepare: 17.66ms
air::preparation_step::preparation::make_exec_ctx: 1.42ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 11.20ms
air_parser::parser::air_parser::parse: 1.73ms
big_values_data (34.61ms): Loading a trace with huge values
air::runner::execute_air: 34.61ms
farewell_step::outcome::from_success_result: 10.10ms
populate_outcome_from_contexts: 8.30ms
to_vec(call_results): 106.00µs
to_vec(data): 5.04ms
preparation_step::preparation::prepare: 20.83ms
air::preparation_step::preparation::make_exec_ctx: 1.56ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 13.87ms
air_parser::parser::air_parser::parse: 2.05ms
runner::execute: 126.00µs
dashboard (103.30ms): big dashboard test
air::runner::execute_air: 103.30ms
farewell_step::outcome::from_success_result: 4.26ms
populate_outcome_from_contexts: 3.49ms
to_vec(call_results): 127.00µs
to_vec(data): 1.73ms
preparation_step::preparation::prepare: 16.36ms
air::preparation_step::preparation::make_exec_ctx: 1.63ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 5.79ms
air_parser::parser::air_parser::parse: 5.98ms
runner::execute: 78.79ms
execute: 66.87ms
execute: 9.53ms
instructions::call::resolved_call::prepare_request_params: 1.49ms
instructions::call::resolved_call::serde_json::to_string(tetraplets): 326.00µs
resolver::resolve::resolve_ast_variable: 316.00µs
resolve_variable: 100.00µs
resolver::resolve::resolve_ast_variable: 922.00µs
resolve_variable: 264.00µs
new: 41.00ms
resolve_ast_scalar: 29.92ms
resolve_ast_variable: 18.44ms
resolve_variable: 5.83ms
long_data (24.19ms): Long data trace
air::runner::execute_air: 24.19ms
farewell_step::outcome::from_success_result: 6.36ms
populate_outcome_from_contexts: 4.77ms
to_vec(call_results): 98.00µs
to_vec(data): 2.14ms
preparation_step::preparation::prepare: 13.75ms
air::preparation_step::preparation::make_exec_ctx: 1.73ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 7.07ms
air_parser::parser::air_parser::parse: 1.73ms
runner::execute: 127.00µs
network_explore (45.66ms): 5 peers of network are discovered
air::runner::execute_air: 45.66ms
farewell_step::outcome::from_success_result: 4.96ms
populate_outcome_from_contexts: 4.20ms
to_vec(call_results): 94.00µs
to_vec(data): 2.09ms
preparation_step::preparation::prepare: 19.04ms
air::preparation_step::preparation::make_exec_ctx: 2.10ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 7.41ms
air_parser::parser::air_parser::parse: 6.61ms
runner::execute: 17.54ms
execute: 10.17ms
execute: 3.47ms
resolve_ast_variable: 544.00µs
resolve_variable: 96.00µs
new: 4.49ms
resolve_ast_scalar: 2.94ms
resolve_ast_variable: 1.76ms
resolve_variable: 537.00µs
parser_10000_100 (46.91ms): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 46.91ms
farewell_step::outcome::from_success_result: 4.02ms
populate_outcome_from_contexts: 3.32ms
to_vec(call_results): 97.00µs
to_vec(data): 1.50ms
preparation_step::preparation::prepare: 33.50ms
air::preparation_step::preparation::make_exec_ctx: 1.45ms
air_parser::parser::air_parser::parse: 28.97ms
runner::execute: 4.27ms
execute: 2.07ms
execute: 431.00µs
new: 475.00µs
dashboard (108.80ms): big dashboard test
air::runner::execute_air: 108.80ms
farewell_step::outcome::from_success_result: 4.55ms
populate_outcome_from_contexts: 3.67ms
to_vec(call_results): 129.00µs
to_vec(data): 2.05ms
preparation_step::preparation::prepare: 19.65ms
air::preparation_step::preparation::make_exec_ctx: 2.13ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 8.52ms
air_parser::parser::air_parser::parse: 6.38ms
runner::execute: 80.74ms
execute: 68.82ms
execute: 12.66ms
instructions::call::resolved_call::prepare_request_params: 1.14ms
instructions::call::resolved_call::serde_json::to_string(tetraplets): 187.00µs
resolver::resolve::resolve_ast_variable: 309.00µs
resolve_variable: 95.00µs
resolver::resolve::resolve_ast_variable: 891.00µs
resolve_variable: 258.00µs
new: 39.46ms
resolve_ast_scalar: 28.76ms
resolve_ast_variable: 17.71ms
resolve_variable: 5.49ms
long_data (25.93ms): Long data trace
air::runner::execute_air: 25.93ms
farewell_step::outcome::from_success_result: 6.53ms
populate_outcome_from_contexts: 4.85ms
to_vec(call_results): 92.00µs
to_vec(data): 2.27ms
preparation_step::preparation::prepare: 15.86ms
air::preparation_step::preparation::make_exec_ctx: 2.14ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 9.17ms
air_parser::parser::air_parser::parse: 1.90ms
runner::execute: 121.00µs
network_explore (47.20ms): 5 peers of network are discovered
air::runner::execute_air: 47.20ms
farewell_step::outcome::from_success_result: 4.91ms
populate_outcome_from_contexts: 4.09ms
to_vec(call_results): 90.00µs
to_vec(data): 2.16ms
preparation_step::preparation::prepare: 20.07ms
air::preparation_step::preparation::make_exec_ctx: 2.25ms
air_interpreter_data::interpreter_data::serde_json::from_slice: 8.97ms
air_parser::parser::air_parser::parse: 6.48ms
runner::execute: 18.57ms
execute: 11.50ms
execute: 5.08ms
resolve_ast_variable: 333.00µs
resolve_variable: 92.00µs
new: 3.96ms
resolve_ast_scalar: 2.54ms
resolve_ast_variable: 1.71ms
resolve_variable: 442.00µs
parser_10000_100 (46.04ms): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 46.04ms
farewell_step::outcome::from_success_result: 3.87ms
populate_outcome_from_contexts: 3.00ms
to_vec(call_results): 92.00µs
to_vec(data): 1.56ms
preparation_step::preparation::prepare: 31.76ms
air::preparation_step::preparation::make_exec_ctx: 1.46ms
air_parser::parser::air_parser::parse: 27.38ms
runner::execute: 6.19ms
execute: 4.02ms
execute: 2.42ms
new: 435.00µs

View File

@ -0,0 +1,25 @@
# Preparing data for the performance_metering
One may need to regenerate data on changing data format. Here is the instruction for data regeneration.
## `parser_10000_100`
Data is empty, no regeneration required.
## `dashboard` and `network_explore`
Run `junk/gen_test_data`. No WASM binary required. It will generate prev and current data as JSON files
with prefixes `dashboard` and `explore`.
## `big_data` and `long_data`
In the `junk/cidify` directory, run
``` sh
cargo run -- ./anomaly_big.json simple-calls-info.json > ../../air/benches/data/anomaly_big.json
cargo run -- ./anomaly_long.json simple-calls-info.json > ../../air/benches/data/anomaly_long.json
cp ../../air/benches/data/anomaly_big.json ../../benches/performance_metering/big_values_data/prev_data.json
cp ../../air/benches/data/anomaly_long.json ../../benches/performance_metering/long_data/cur_data.json
```
You may need update the `cidify` tool if you change data format again.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,5 +7,8 @@ publish = false
[dependencies]
air-interpreter-cid = { version = "0.2.0", path = "../../crates/air-lib/interpreter-cid" }
air-interpreter-data = { version = "0.6.0", path = "../../crates/air-lib/interpreter-data" }
aquavm-air = { path = "../../air" }
air-test-utils = { path = "../../crates/air-lib/test-utils" }
clap = { version = "4.1.13", features = ["derive"] }
serde = { version = "1.0.158", features = ["derive"]}
serde_json = "1.0.94"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
{
"cycle": true,
"call_info": [{
"peer": "init_peer_id"
}]
}

View File

@ -1,37 +1,82 @@
use serde::{Deserialize, Serialize};
use air_interpreter_data::ExecutedState;
use clap::Parser;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::{json, Value};
use std::path::PathBuf;
#[derive(Deserialize, Debug, Serialize)]
pub struct PreCidInterpeterData {
trace: Vec<serde_json::Value>,
struct PreCidInterpeterData {
trace: Vec<Value>,
#[serde(flatten)]
other_fields: serde_json::Value,
other_fields: Value,
}
#[derive(Debug, Deserialize)]
struct TraceCalls {
cycle: Option<bool>,
call_info: Vec<CallInfo>,
}
impl TraceCalls {
fn into_iter(self) -> Box<dyn Iterator<Item = CallInfo>> {
if self.cycle.unwrap_or_default() {
Box::new(self.call_info.into_iter().cycle()) as _
} else {
Box::new(self.call_info.into_iter()) as _
}
}
}
#[derive(Clone, Debug, Deserialize)]
struct CallInfo {
peer: String,
service: Option<String>,
function: Option<String>,
args: Option<Vec<Value>>,
json_path: Option<String>,
kind: Option<Kind>,
}
#[derive(Clone, Debug, Deserialize)]
enum Kind {
Stream,
Scalar,
Unused,
}
#[derive(Parser)]
struct Args {
data_path: PathBuf,
calls_path: PathBuf,
}
fn main() {
let stdin = std::io::stdin();
let mut data: PreCidInterpeterData =
serde_json::from_reader(stdin).expect("Expect to be readable");
let mut values = air_interpreter_data::CidTracker::<Value>::new();
let args = Args::parse();
let mut data: PreCidInterpeterData = read_data(args.data_path);
let calls: TraceCalls = read_data(args.calls_path);
let mut calls = calls.into_iter();
let mut cid_state = air::ExecutionCidState::new();
for elt in &mut data.trace {
let obj = elt.as_object_mut().unwrap();
if let Some(call) = obj.get_mut("call") {
if let Some(executed) = call.as_object_mut().unwrap().get_mut("executed") {
if let Some(scalar) = executed.as_object_mut().unwrap().get_mut("scalar") {
let cid = values.record_value(scalar.clone()).expect("Expect to CID");
*scalar = json!(cid);
let call_info = calls.next().expect("More calls than call_info");
let state = transform_cid(scalar.take(), call_info, &mut cid_state);
*elt = json!(state);
}
}
}
}
data.other_fields.as_object_mut().unwrap().insert(
"cid_info".to_owned(),
json!({
"value_store": Into::<air_interpreter_data::CidStore<_>>::into(values),
"tetraplet_store": {},
"canon_store": {},
}),
serde_json::to_value(Into::<air_interpreter_data::CidInfo>::into(cid_state)).unwrap(),
);
data.other_fields
.as_object_mut()
@ -39,3 +84,38 @@ fn main() {
.insert("interpreter_version".to_owned(), json!("0.35.1"));
serde_json::to_writer(std::io::stdout(), &data).unwrap();
}
fn read_data<T: DeserializeOwned>(path: PathBuf) -> T {
let inp = std::fs::File::open(path).unwrap();
serde_json::from_reader(inp).unwrap()
}
fn transform_cid(
value: Value,
meta: CallInfo,
cid_state: &mut air::ExecutionCidState,
) -> ExecutedState {
use air_test_utils::executed_state::ExecutedCallBuilder;
let mut builder = ExecutedCallBuilder::new(value);
builder = builder.peer(meta.peer);
if let Some(service) = meta.service {
builder = builder.service(service);
}
if let Some(function) = meta.function {
builder = builder.function(function);
}
if let Some(args) = meta.args {
builder = builder.args(args);
}
if let Some(json_path) = meta.json_path {
builder = builder.json_path(json_path);
}
match meta.kind {
Some(Kind::Scalar) | None => builder.scalar_tracked(cid_state),
Some(Kind::Unused) => builder.unused(),
Some(Kind::Stream) => unimplemented!("no stream in test data"),
}
}

3289
junk/gen_test_data/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
[package]
name = "gen_test_data_dashboard"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
air-test-utils = { path = "../../crates/air-lib/test-utils" , features = ["test_with_native_code"] }
maplit = "1.0.2"
serde_json = "1.0.91"

View File

@ -0,0 +1,366 @@
/*
* Copyright 2023 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use air_test_utils::prelude::*;
use std::cell::RefCell;
use std::collections::HashSet;
use std::rc::Rc;
fn parse_peers() -> Vec<String> {
let data = include_str!("dashboard/peers");
data.split("\n").map(str::to_owned).collect()
}
fn into_hashset(peers: Vec<String>) -> HashSet<String> {
peers.into_iter().collect()
}
fn client_host_function(
known_peers: Vec<String>,
client_id: String,
relay_id: String,
) -> (CallServiceClosure, Rc<RefCell<String>>) {
let all_info = Rc::new(RefCell::new(String::new()));
let known_peers = JValue::Array(
known_peers
.iter()
.cloned()
.map(JValue::String)
.collect::<Vec<_>>(),
);
let client_id = JValue::String(client_id);
let relay_id = JValue::String(relay_id);
let to_ret_value = Box::new(
move |service_name: &str, function_name: &str, arguments: Vec<String>| -> JValue {
if !service_name.is_empty() || function_name != "load" || arguments.len() != 1 {
return JValue::Null;
}
match arguments[0].as_str() {
"relayId" => relay_id.clone(),
"knownPeers" => known_peers.clone(),
"clientId" => client_id.clone(),
_ => JValue::Null,
}
},
);
let all_info_inner = all_info.clone();
let host_function: CallServiceClosure = Box::new(move |params| -> CallServiceResult {
let ret_value = match serde_json::from_value(JValue::Array(params.arguments.clone())) {
Ok(args) => to_ret_value(
params.service_id.as_str(),
params.function_name.as_str(),
args,
),
Err(_) => {
*all_info_inner.borrow_mut() = JValue::Array(params.arguments).to_string();
JValue::Null
}
};
CallServiceResult::ok(ret_value)
});
(host_function, all_info)
}
fn peer_host_function(
known_peers: Vec<String>,
blueprints: Vec<String>,
modules: Vec<String>,
interfaces: Vec<String>,
ident: String,
) -> CallServiceClosure {
let known_peers = JValue::Array(known_peers.into_iter().map(JValue::String).collect());
let blueprints = JValue::Array(blueprints.into_iter().map(JValue::String).collect());
let modules = JValue::Array(modules.into_iter().map(JValue::String).collect());
let interfaces = JValue::Array(interfaces.into_iter().map(JValue::String).collect());
let identify = JValue::String(ident.clone());
let ident = JValue::String(ident);
let to_ret_value = Box::new(
move |service_name: &str, function_name: &str, arguments: Vec<&str>| -> JValue {
match (service_name, function_name, arguments.as_slice()) {
("op", "identity", _) => ident.clone(),
("op", "identify", _) => identify.clone(),
("dist", "get_blueprints", _) => blueprints.clone(),
("dist", "get_modules", _) => modules.clone(),
("srv", "get_interfaces", _) => interfaces.clone(),
("dht", "neighborhood", _) => known_peers.clone(),
_ => JValue::Null,
}
},
);
Box::new(move |params| -> CallServiceResult {
let args: Vec<String> = serde_json::from_value(JValue::Array(params.arguments)).unwrap();
let t_args = args.iter().map(|s| s.as_str()).collect::<Vec<_>>();
let ret_value = to_ret_value(
params.service_id.as_str(),
params.function_name.as_str(),
t_args,
);
CallServiceResult::ok(ret_value)
})
}
#[rustfmt::skip]
fn create_peer_host_function(peer_id: String, known_peer_ids: Vec<String>) -> CallServiceClosure {
let relay_blueprints = (0..=2).map(|id| f!("{peer_id}_blueprint_{id}")).collect::<Vec<_>>();
let relay_modules = (0..=2).map(|id| f!("{peer_id}_module_{id}")).collect::<Vec<_>>();
let relay_interfaces = (0..=2).map(|id| f!("{peer_id}_interface_{id}")).collect::<Vec<_>>();
let relay_ident = f!("{peer_id}_ident");
peer_host_function(
known_peer_ids,
relay_blueprints,
relay_modules,
relay_interfaces,
relay_ident,
)
}
struct AVMState {
vm: TestRunner,
peer_id: String,
prev_result: Vec<u8>,
}
pub(crate) fn dashboard() -> (Vec<u8>, Vec<u8>) {
let script = include_str!("dashboard/dashboard.air");
let known_peer_ids = parse_peers();
let client_id = "client_id".to_string();
let relay_id = "relay_id".to_string();
let (host_function, all_info) =
client_host_function(known_peer_ids.clone(), client_id.clone(), relay_id.clone());
let mut client = create_avm(host_function, client_id.clone());
let mut relay = create_avm(
create_peer_host_function(relay_id.clone(), known_peer_ids.clone()),
relay_id.clone(),
);
let mut known_peers = known_peer_ids
.iter()
.cloned()
.map(|peer_id| {
let vm = create_avm(
create_peer_host_function(peer_id.clone(), known_peer_ids.clone()),
peer_id.clone(),
);
AVMState {
vm,
peer_id,
prev_result: vec![],
}
})
.collect::<Vec<_>>();
let test_params = TestRunParameters::from_init_peer_id(client_id.clone());
// -> client 1
let client_1_result = checked_call_vm!(client, test_params.clone(), script, "", "");
let next_peer_pks = into_hashset(client_1_result.next_peer_pks);
let mut all_peer_pks = into_hashset(known_peer_ids);
all_peer_pks.insert(relay_id.clone());
assert_eq!(next_peer_pks, all_peer_pks);
// client 1 -> relay 1
let relay_1_result = checked_call_vm!(
relay,
test_params.clone(),
script,
client_1_result.data.clone(),
""
);
let next_peer_pks = into_hashset(relay_1_result.next_peer_pks.clone());
all_peer_pks.remove(&relay_id);
all_peer_pks.insert(client_id.clone());
assert_eq!(next_peer_pks, all_peer_pks);
// relay 1 -> client 2
let client_2_result = checked_call_vm!(
client,
test_params.clone(),
script,
client_1_result.data.clone(),
relay_1_result.data.clone()
);
assert!(client_2_result.next_peer_pks.is_empty());
assert_eq!(
*all_info.borrow(),
String::from(
r#"["relay_id","relay_id_ident",["relay_id_interface_0","relay_id_interface_1","relay_id_interface_2"],["relay_id_blueprint_0","relay_id_blueprint_1","relay_id_blueprint_2"],["relay_id_module_0","relay_id_module_1","relay_id_module_2"]]"#
)
);
let mut relay_2_result = relay_1_result.clone();
let mut client_3_result = client_2_result;
// peers 1 -> relay 2 -> client 3
for avm in known_peers.iter_mut() {
let prev_result = std::mem::take(&mut avm.prev_result);
let known_peer_result = checked_call_vm!(
avm.vm,
test_params.clone(),
script,
prev_result,
client_1_result.data.clone()
);
assert_eq!(known_peer_result.next_peer_pks, vec![relay_id.clone()]);
avm.prev_result = known_peer_result.data;
relay_2_result = checked_call_vm!(
relay,
test_params.clone(),
script,
relay_2_result.data.clone(),
avm.prev_result.clone()
);
assert_eq!(relay_2_result.next_peer_pks, vec![client_id.clone()]);
client_3_result = checked_call_vm!(
client,
test_params.clone(),
script,
client_3_result.data.clone(),
relay_2_result.data.clone()
);
assert!(client_3_result.next_peer_pks.is_empty());
assert_eq!(
*all_info.borrow(),
format!(
r#"["{peer_id}","{peer_id}_ident",["{peer_id}_interface_0","{peer_id}_interface_1","{peer_id}_interface_2"],["{peer_id}_blueprint_0","{peer_id}_blueprint_1","{peer_id}_blueprint_2"],["{peer_id}_module_0","{peer_id}_module_1","{peer_id}_module_2"]]"#,
peer_id = avm.peer_id
)
)
}
all_peer_pks.remove(&client_id);
all_peer_pks.insert(relay_id.to_string());
let mut relay_3_result = relay_2_result;
let mut client_4_result = client_3_result;
// peers 2 -> relay 3 -> client 4
for avm in known_peers.iter_mut() {
let prev_result = std::mem::take(&mut avm.prev_result);
let known_peer_result = checked_call_vm!(
avm.vm,
test_params.clone(),
script,
prev_result,
relay_1_result.data.clone()
);
all_peer_pks.remove(&avm.peer_id);
let next_peer_pks = into_hashset(known_peer_result.next_peer_pks.clone());
assert_eq!(next_peer_pks, all_peer_pks);
all_peer_pks.insert(avm.peer_id.clone());
avm.prev_result = known_peer_result.data;
relay_3_result = checked_call_vm!(
relay,
test_params.clone(),
script,
relay_3_result.data.clone(),
avm.prev_result.clone()
);
assert_eq!(relay_3_result.next_peer_pks, vec![client_id.clone()]);
// client -> peers -> relay -> client
client_4_result = checked_call_vm!(
client,
test_params.clone(),
script,
client_4_result.data.clone(),
relay_3_result.data.clone()
);
assert!(client_4_result.next_peer_pks.is_empty());
assert_eq!(
*all_info.borrow(),
format!(
r#"["{peer_id}","{peer_id}_ident",["{peer_id}_interface_0","{peer_id}_interface_1","{peer_id}_interface_2"],["{peer_id}_blueprint_0","{peer_id}_blueprint_1","{peer_id}_blueprint_2"],["{peer_id}_module_0","{peer_id}_module_1","{peer_id}_module_2"]]"#,
peer_id = avm.peer_id
)
)
}
let mut relay_4_result = relay_3_result;
let mut client_5_result = client_4_result;
// peers 2 -> peers 3 -> relay 4 -> client 5
for i in 0..(known_peers.len() - 1) {
for j in 0..known_peers.len() {
if known_peers[i].peer_id == known_peers[j].peer_id {
continue;
}
let prev_data = known_peers[j].prev_result.clone();
let data = known_peers[i].prev_result.clone();
let known_peer_i_j_result = checked_call_vm!(
known_peers[j].vm,
test_params.clone(),
script,
prev_data,
data
);
assert_eq!(known_peer_i_j_result.next_peer_pks, vec![relay_id.clone()]);
known_peers[j].prev_result = known_peer_i_j_result.data;
relay_4_result = checked_call_vm!(
relay,
test_params.clone(),
script,
relay_4_result.data.clone(),
known_peers[j].prev_result.clone()
);
assert_eq!(relay_4_result.next_peer_pks, vec![client_id.clone()]);
// client -> peers -> relay -> client
client_5_result = checked_call_vm!(
client,
test_params.clone(),
script,
client_5_result.data.clone(),
relay_4_result.data.clone()
);
assert!(client_5_result.next_peer_pks.is_empty());
assert_eq!(
*all_info.borrow(),
format!(
r#"["{peer_id}","{peer_id}_ident",["{peer_id}_interface_0","{peer_id}_interface_1","{peer_id}_interface_2"],["{peer_id}_blueprint_0","{peer_id}_blueprint_1","{peer_id}_blueprint_2"],["{peer_id}_module_0","{peer_id}_module_1","{peer_id}_module_2"]]"#,
peer_id = known_peers[j].peer_id
)
);
}
}
(
known_peers.last().unwrap().prev_result.clone(),
known_peers.first().unwrap().prev_result.clone(),
)
}

View File

@ -0,0 +1 @@
../../../../benches/performance_metering/dashboard/script.air

View File

@ -0,0 +1,7 @@
12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9
12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE1
12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb
12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB
12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb
12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz
12D3KooWPnLxnY71JDxvB3zbjKu9k1BCYNthGZw6iGrLYsR1RnWM

View File

@ -0,0 +1,40 @@
/*
* Copyright 2023 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mod dashboard;
mod network_explore;
use std::fs::File;
use std::io::Write;
fn main() -> std::io::Result<()> {
let dashboard_datas = dashboard::dashboard();
save_datas("dashboard", &dashboard_datas.0, &dashboard_datas.1)?;
let explore_datas = network_explore::network_explore();
save_datas("explore", &explore_datas.0, &explore_datas.1)?;
Ok(())
}
fn save_datas(prefix: &str, prev_data: &[u8], current_data: &[u8]) -> std::io::Result<()> {
let mut prev = File::create(format!("{}_prev_data.json", prefix))?;
prev.write_all(prev_data)?;
let mut cur = File::create(format!("{}_cur_data.json", prefix))?;
cur.write_all(current_data)?;
Ok(())
}

View File

@ -0,0 +1 @@
../../../benches/performance_metering/network_explore/script.air

View File

@ -0,0 +1,121 @@
/*
* Copyright 2023 Fluence Labs Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use air_test_utils::prelude::*;
pub(crate) fn network_explore() -> (Vec<u8>, Vec<u8>) {
let relay_id = "relay_id";
let client_id = "client_id";
let set_variables_state = maplit::hashmap!(
"relay".to_string() => json!(relay_id),
"client".to_string() => json!(client_id),
);
let client_call_service = set_variables_call_service(set_variables_state, VariableOptionSource::Argument(0));
let mut client = create_avm(client_call_service, client_id);
let client_1_id = "client_1_id";
let client_2_id = "client_2_id";
let client_3_id = "client_3_id";
let relay_call_service = set_variable_call_service(json!([client_1_id, client_2_id, client_3_id, relay_id]));
let mut relay = create_avm(relay_call_service, relay_id);
let client_1_call_service = set_variable_call_service(json!([client_1_id, client_3_id, relay_id, client_2_id]));
let mut client_1 = create_avm(client_1_call_service, client_1_id);
let client_2_call_service = set_variable_call_service(json!([relay_id, client_3_id, client_1_id, client_2_id]));
let mut client_2 = create_avm(client_2_call_service, client_2_id);
let client_3_call_service = set_variable_call_service(json!([relay_id, client_3_id, client_1_id, client_2_id]));
let mut client_3 = create_avm(client_3_call_service, client_3_id);
let script = include_str!("network_explore.air");
let client_result = checked_call_vm!(client, <_>::default(), script, "", "");
assert_next_pks!(&client_result.next_peer_pks, &[relay_id]);
let relay_result = checked_call_vm!(relay, <_>::default(), script, "", client_result.data.clone());
assert_next_pks!(&relay_result.next_peer_pks, &[client_1_id]);
let client_1_result = checked_call_vm!(client_1, <_>::default(), script, "", relay_result.data.clone());
assert_next_pks!(&client_1_result.next_peer_pks, &[client_2_id]);
let client_2_result = checked_call_vm!(client_2, <_>::default(), script, "", client_1_result.data.clone());
assert_next_pks!(&client_2_result.next_peer_pks, &[client_3_id]);
let client_3_result = checked_call_vm!(client_3, <_>::default(), script, "", client_2_result.data.clone());
assert_next_pks!(&client_3_result.next_peer_pks, &[relay_id]);
let relay_result = checked_call_vm!(
relay,
<_>::default(),
script,
relay_result.data,
client_3_result.data.clone()
);
// assert_next_pks!(&relay_result.next_peer_pks, &[client_1_id]);
let client_1_result = checked_call_vm!(
client_1,
<_>::default(),
script,
client_1_result.data,
relay_result.data.clone()
);
// assert_next_pks!(&client_1_result.next_peer_pks, &[client_3_id]);
let client_3_result = checked_call_vm!(
client_3,
<_>::default(),
script,
client_3_result.data,
client_1_result.data.clone()
);
// assert_next_pks!(&client_3_result.next_peer_pks, &[relay_id]);
let relay_result = checked_call_vm!(
relay,
<_>::default(),
script,
relay_result.data,
client_3_result.data.clone()
);
assert_next_pks!(&relay_result.next_peer_pks, &[client_2_id]);
let client_2_result = checked_call_vm!(
client_2,
<_>::default(),
script,
client_2_result.data,
relay_result.data.clone()
);
assert_next_pks!(&client_2_result.next_peer_pks, &[client_3_id]);
let client_3_result = checked_call_vm!(
client_3,
<_>::default(),
script,
client_3_result.data,
client_2_result.data.clone()
);
assert_next_pks!(&client_3_result.next_peer_pks, &[relay_id]);
(
relay_result.data,
client_3_result.data.clone()
)
}

View File

@ -53,6 +53,9 @@ pub(crate) struct Args {
#[clap(long, help = "Output JSON tracing info")]
json: bool,
#[clap(long = "no-fail", help = "Do not fail if AquaVM returns error")]
no_fail: bool,
#[clap(subcommand)]
source: Source,
}
@ -108,6 +111,9 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> {
if args.repeat.is_none() {
println!("{result:?}");
}
if !args.no_fail && (result.ret_code != 0) {
std::process::exit(2);
}
}
Ok(())

View File

@ -16,6 +16,7 @@
"""Running benches."""
import logging
import operator
import os
import subprocess
import typing
@ -50,10 +51,14 @@ def discover_tests(bench_dir: typing.Optional[str]) -> list[Bench]:
"""Discover bench suite elements."""
if bench_dir is None:
bench_dir = DEFAULT_TEST_DIR
return list(map(
lambda filename: Bench(os.path.join(bench_dir, filename)),
sorted(os.listdir(bench_dir))
))
return [
Bench(ent.path)
for ent in sorted(
os.scandir(bench_dir),
key=operator.attrgetter('name'),
)
if ent.is_dir(follow_symlinks=True)
]
def run(args):