Skip to content

Commit 797e468

Browse files
patricklabatutfacebook-github-bot
authored andcommitted
Rename mesh I/O benchmarks and associated methods
Summary: Rename mesh I/O benchmarks and associated methods: - add `simple` qualifier (benchmark on more realistic mesh data to be added later) - align naming between OBJ and PLY - prefix with `bm_` to make the benchmarking purpose clear(er) Reviewed By: nikhilaravi Differential Revision: D20390764 fbshipit-source-id: 7714520abfcfe1125067f3c52f7ce19bca359574
1 parent 3c71ab6 commit 797e468

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

tests/bm_mesh_io.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,32 @@
77

88

99
def bm_save_load() -> None:
10-
kwargs_list = [
10+
simple_kwargs_list = [
1111
{"V": 100, "F": 300},
1212
{"V": 1000, "F": 3000},
1313
{"V": 10000, "F": 30000},
1414
]
1515
benchmark(
16-
TestMeshObjIO.load_obj_with_init,
17-
"LOAD_OBJ",
18-
kwargs_list,
16+
TestMeshObjIO.bm_load_simple_obj_with_init,
17+
"LOAD_SIMPLE_OBJ",
18+
simple_kwargs_list,
1919
warmup_iters=1,
2020
)
2121
benchmark(
22-
TestMeshObjIO.save_obj_with_init,
23-
"SAVE_OBJ",
24-
kwargs_list,
22+
TestMeshObjIO.bm_save_simple_obj_with_init,
23+
"SAVE_SIMPLE_OBJ",
24+
simple_kwargs_list,
2525
warmup_iters=1,
2626
)
2727
benchmark(
28-
TestMeshPlyIO.load_ply_bm, "LOAD_PLY", kwargs_list, warmup_iters=1
28+
TestMeshPlyIO.bm_load_simple_ply_with_init,
29+
"LOAD_SIMPLE_PLY",
30+
simple_kwargs_list,
31+
warmup_iters=1,
2932
)
3033
benchmark(
31-
TestMeshPlyIO.save_ply_bm, "SAVE_PLY", kwargs_list, warmup_iters=1
34+
TestMeshPlyIO.bm_save_simple_ply_with_init,
35+
"SAVE_SIMPLE_PLY",
36+
simple_kwargs_list,
37+
warmup_iters=1,
3238
)

tests/test_obj_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def check_item(x, y):
602602
self.assertClose(cow3_tea.faces_list()[3], mesh_teapot.faces_list()[0])
603603

604604
@staticmethod
605-
def save_obj_with_init(V: int, F: int):
605+
def bm_save_simple_obj_with_init(V: int, F: int):
606606
verts_list = torch.tensor(V * [[0.11, 0.22, 0.33]]).view(-1, 3)
607607
faces_list = torch.tensor(F * [[1, 2, 3]]).view(-1, 3)
608608
obj_file = StringIO()
@@ -613,7 +613,7 @@ def save_mesh():
613613
return save_mesh
614614

615615
@staticmethod
616-
def load_obj_with_init(V: int, F: int):
616+
def bm_load_simple_obj_with_init(V: int, F: int):
617617
obj = "\n".join(["v 0.1 0.2 0.3"] * V + ["f 1 2 3"] * F)
618618

619619
def load_mesh():

tests/test_ply_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def test_bad_ply_syntax(self):
407407
load_ply(StringIO("\n".join(lines2)))
408408

409409
@staticmethod
410-
def save_ply_bm(V: int, F: int):
410+
def bm_save_simple_ply_with_init(V: int, F: int):
411411
verts_list = torch.tensor(V * [[0.11, 0.22, 0.33]]).view(-1, 3)
412412
faces_list = torch.tensor(F * [[0, 1, 2]]).view(-1, 3)
413413

@@ -418,7 +418,7 @@ def save_mesh():
418418
return save_mesh
419419

420420
@staticmethod
421-
def load_ply_bm(V: int, F: int):
421+
def bm_load_simple_ply_with_init(V: int, F: int):
422422
verts = torch.tensor([[0.1, 0.2, 0.3]]).expand(V, 3)
423423
faces = torch.tensor([[0, 1, 2]], dtype=torch.int64).expand(F, 3)
424424
ply_file = StringIO()

0 commit comments

Comments
 (0)