ansys / pyedb-core

Ansys Electronics Database Python Client Package
https://edb.core.docs.pyansys.com/
MIT License
2 stars 1 forks source link

Performance issues on grpc api #371

Closed svandenb-dev closed 5 months ago

svandenb-dev commented 6 months ago

🔍 Before submitting the issue

🐞 Description of the bug

I connected the unit test from pyedb. First test from passed but was slow. Since I can switch the test from .NET to grpc, using the same code, same project here is a picture from the difference directly printed from the code execution (time is in second)

same command from unit test grpc and .NET selected_pins = [pin for pin in self._pedb.components.components[ref].pins.values() if pin.net_name in net_list and pin.is_pin]

PyEDB INFO: EDB initialized. PASSED [100%]Fetching pins belonging to net DDR4_DQS0_P and DDR4_DQS0_N time_elapsed grpc api : 62.692482233047485 Fetching pins belonging to net DDR4_DQS0_P and DDR4_DQS0_N time_elapsed grpc api : 62.796724796295166

PyEDB INFO: EDB initialized. PASSED [100%]Fetching pins usinh .NET api time_elapsed .NET api : 0.07809185981750488 Fetching pins usinh .NET api time_elapsed .NET api : 0.0821077823638916

this command is retrieving pins (e.g. padstack instances with checking the net_name)

📝 Steps to reproduce

NA

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

NA

🐍 Which Python version are you using?

3.9

📦 Installed packages

NA
hiro727 commented 5 months ago

the number of queries is the real bottleneck here. two options:

  1. do filtering on backend
    pins = components.pins(net=net_list, is_pin: True)
  2. send back all attributes of PadstackInstance to avoid n + 1 queries
    components.pins
    #=> [
    #   PadstackInstance({ id: 1, net_name: "net1", is_pin: True }),
    #   PadstackInstance({ id: 2, net_name: "net2", is_pin: False })
    #   # etc
    # ]
svandenb-dev commented 5 months ago

closing this issue. It seems to be related to pyedb code. So I have to investigate on my side before performing addionnal tests.