Skip to content

Commit 0959c1a

Browse files
committed
add benchmark for build_binding_protos
1 parent d7905dd commit 0959c1a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
import pytest
5+
6+
import azure_functions_worker.loader as loader
7+
from azure.functions import Function
8+
from azure.functions.decorators.core import InputBinding
9+
10+
11+
def dummy_func():
12+
...
13+
14+
15+
class FakeInputBinding(InputBinding):
16+
17+
def __init__(self,
18+
name):
19+
super().__init__(name=name, data_type=None)
20+
21+
@staticmethod
22+
def get_binding_name() -> str:
23+
return "test_binding"
24+
25+
26+
@pytest.mark.parametrize("size", range(10))
27+
def test_build_binding_protos(benchmark, size):
28+
f = Function(dummy_func, "foo.py")
29+
for i in range(size):
30+
f.add_binding(FakeInputBinding(f"test_binding{i}"))
31+
r = benchmark(loader.build_binding_protos, f)

0 commit comments

Comments
 (0)