Tweaks to benchmarks.

- Modify parse_benchmark_test to not time the first instance of file loading.
- Improve readability of step_benchmark_test.

PiperOrigin-RevId: 680953562
Change-Id: I4569d1b946ecb49b6590ea313f0b598ffc897888
This commit is contained in:
Yuval Tassa
2024-10-01 04:07:33 -07:00
committed by Copybara-Service
parent cb745db412
commit 62ec802ec1
2 changed files with 9 additions and 7 deletions
+6 -3
View File
@@ -54,11 +54,14 @@ static void run_parse_benchmark(const std::string xml_path,
ASSERT_THAT(vfs_errno, Eq(0)) << "Failed to add file to VFS: " << vfs_errmsg;
// load once to warm up filesystem and compiler cache
std::array<char, 1024> error;
for (auto s : state) {
mjModel* model =
mjModel* model =
mj_loadXML(xml_path.data(), vfs.get(), error.data(), error.size());
ASSERT_THAT(model, NotNull()) << "Failed to load model: " << error.data();
ASSERT_THAT(model, NotNull()) << "Failed to load model: " << error.data();
for (auto s : state) {
mjModel* model = mj_loadXML(xml_path.data(), vfs.get(), 0, 0);
mj_deleteModel(model);
}
state.SetLabel(xml_path);