simphony / simphony-osp

A framework that aims to achieve interoperability between software such as simulation engines, databases and data repositories using a knowledge graph as the common language.
https://simphony.readthedocs.io
Other
16 stars 12 forks source link

Improve performance and adapt existing bechmarks to SimPhoNy v4 #789

Closed kysrpex closed 2 years ago

kysrpex commented 2 years ago

Something similar was being done already on SimPhoNy v3, but this time the solution, even though it is quite similar, seems to be more effective.


The performance was evaluated using the following code snippets.

SimPhoNy v4

from simphony_osp.namespaces import mechanical as mt
from simphony_osp.namespaces import math, metrology
from simphony_osp.namespaces import properties as prop
from time import time
from tqdm import tqdm

n = (333636 // 3)

start = time()
for i in tqdm(range(0, n)):
    bending_stiffness_average_value = 0.0312  # some numerical value
    cableSystem = mt.CableBundle()
    bendingStiffness_average = mt.BendingStiffness()
    realNumber = math.Real(hasNumericalData=bending_stiffness_average_value)
    bendingStiffness_average.connect(realNumber, rel=metrology.hasQuantityValue)
    cableSystem.connect(bendingStiffness_average, rel=prop.hasProperty)
end = time()
print("time %.2f" % (end - start))

SimPhoNy v3

from osp.core.namespaces import mechanical as mt
from osp.core.namespaces import math, metrology
from osp.core.namespaces import properties as prop
from time import time
from tqdm import tqdm

n = (333636 // 3)

start = time()
for i in tqdm(range(0, n)):
    bending_stiffness_average_value = 0.0312  # some numerical value
    cableSystem = mt.CableBundle()
    bendingStiffness_average = mt.BendingStiffness()
    realNumber = math.Real(hasNumericalData=bending_stiffness_average_value)
    bendingStiffness_average.add(realNumber, rel=metrology.hasQuantityValue)
    cableSystem.add(bendingStiffness_average, rel=prop.hasProperty)
end = time()
print("time %.2f" % (end - start))

Estimation given by tqdm for each case:


Edit: actually the performance increased due to other factors since the SimphoNy v3 test, so it is now just on the same range (see picture below from continuous benchmarking system).

grafik