Skip to content

Commit 50e09df

Browse files
committed
add add_nodes perf-test
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent eff346e commit 50e09df

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

tests/performance/grid_performance_tests.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]>
22
#
33
# SPDX-License-Identifier: MPL-2.0
4-
54
from tests.performance._helpers import do_performance_test
65

76
# pylint: disable=missing-function-docstring
87

8+
def perf_test_add_nodes():
9+
setup_code = {
10+
"grid" : "from power_grid_model_ds import Grid;"
11+
+ "from power_grid_model_ds._core.model.arrays import NodeArray;"
12+
+ "grid = Grid.empty();"
13+
+ "nodes = NodeArray.zeros({size});"
14+
}
15+
16+
code_to_test = [
17+
"grid.append(nodes);"
18+
]
19+
20+
do_performance_test(code_to_test, [10, 1000, 5000], 100, setup_code)
21+
922

10-
def test_get_downstream_nodes_performance():
23+
def perf_test_get_downstream_nodes_performance():
1124
setup_code = {
1225
"grid": "import numpy as np;"
1326
+ "from power_grid_model_ds.enums import NodeType;"
@@ -27,4 +40,5 @@ def test_get_downstream_nodes_performance():
2740

2841

2942
if __name__ == "__main__":
30-
test_get_downstream_nodes_performance()
43+
# perf_test_get_downstream_nodes_performance()
44+
perf_test_add_nodes()

0 commit comments

Comments
 (0)