Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Add motivating test
Browse files Browse the repository at this point in the history
  • Loading branch information
iopapamanoglou committed Sep 6, 2024
1 parent 1437458 commit 946234d
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions test/core/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,87 @@ def test_graph_merge_it(self):

print("Counter", GraphImpl.counter, GraphImpl.counter - count)

def test_mif_connect_single(self):
timings = Times()

cnt = 100

for _ in range(cnt):
GraphInterface().connect(GraphInterface())
timings.add("gif")

for _ in range(cnt):
ModuleInterface().connect(ModuleInterface())

timings.add("mif")

for _ in range(cnt):
F.Electrical().connect(F.Electrical())

timings.add("elec")

for _ in range(cnt):
F.ElectricPower().connect(F.ElectricPower())

timings.add("power")

for _ in range(cnt):
F.ElectricLogic().connect(F.ElectricLogic())

timings.add("logic")

for _ in range(cnt):
F.I2C().connect(F.I2C())

timings.add("i2c")

timings.times = {k: v / cnt for k, v in timings.times.items()}

print(timings)

def test_mif_connect_hull(self):
timings = Times()

cnt = 30

gif = GraphInterface()
for _ in range(cnt):
gif.connect(GraphInterface())

timings.add("gif")

mif = ModuleInterface()
for _ in range(cnt):
mif.connect(ModuleInterface())

timings.add("mif")

elec = F.Electrical()
for _ in range(cnt):
elec.connect(F.Electrical())

timings.add("elec")

power = F.ElectricPower()
for _ in range(cnt):
power.connect(F.ElectricPower())

timings.add("power")

logic = F.ElectricLogic()
for _ in range(cnt):
logic.connect(F.ElectricLogic())

timings.add("logic")

i2c = F.I2C()
for _ in range(cnt):
i2c.connect(F.I2C())

timings.add("i2c")

print(timings)


if __name__ == "__main__":
unittest.main()

0 comments on commit 946234d

Please sign in to comment.