pymodbus-dev / pymodbus

A full modbus protocol written in python
Other
2.25k stars 919 forks source link

client_server_sync_test have become very slow on 3.12 for no reason ?? #2131

Closed janiversen closed 5 months ago

pythcoiner commented 6 months ago

i got the same kind issue w/ 2.5.3 server, maybe its about dependencies?

Here example snippet import logging from pymodbus.server.sync import StartSerialServer from pymodbus.datastore import ModbusServerContext, ModbusSlaveContext, ModbusSequentialDataBlock from pymodbus.transaction import ModbusRtuFramer logging.basicConfig() log = logging.getLogger() log.setLevel(logging.DEBUG) store = ModbusSequentialDataBlock(0x6500, [0x00] * 10) store.setValues(0x6505, [4832]) # 48.32Hz slave_context = ModbusSlaveContext(di=None, co=None, hr=store, ir=None) context = ModbusServerContext(slaves=slave_context, single=True) StartSerialServer(context, framer=ModbusRtuFramer, port="/dev/ttyUSB1", baudrate=115200)
pythcoiner commented 6 months ago

upgrading my code to 3.6.6 tend to solve my issue

Code import logging from pymodbus.server import StartSerialServer from pymodbus.datastore import ModbusServerContext, ModbusSlaveContext, ModbusSequentialDataBlock from pymodbus.transaction import ModbusRtuFramer logging.basicConfig() log = logging.getLogger() log.setLevel(logging.DEBUG) store = ModbusSequentialDataBlock(0x6500, [0x00] * 10) store.setValues(0x6505, [4832]) # 48.32Hz slave_context = ModbusSlaveContext(di=None, co=None, hr=store, ir=None) context = ModbusServerContext(slaves=slave_context, single=True) StartSerialServer(context=context, framer=ModbusRtuFramer, port="/dev/ttyUSB1", baudrate=115200)
janiversen commented 6 months ago

We do no support v2.5.3. This issue is about a difference between v3.6.5 and dev.

pythcoiner commented 6 months ago

We do no support v2.5.3. This issue is about a difference between v3.6.5 and dev.

i do not expect you to support, i just notice it in case it can helps.

janiversen commented 6 months ago

Well it does not, that test worked very differently in 2.5.3 (the server was actually sync).

And 2.5.3 most likely do not work either python 3.12...seems you misunderstood the issue, the test is a lot faster on oython 3.11 than with python 3.12.

but thanks for your comment.

pythcoiner commented 6 months ago

Well it does not, that test worked very differently in 2.5.3 (the server was actually sync).

And 2.5.3 most likely do not work either python 3.12...seems you misunderstood the issue, the test is a lot faster on oython 3.11 than with python 3.12.

but thanks for your comment.

honnestly i don't know about 3.12 but i have several systems in production using 2.5.3 w/ 3.11

janiversen commented 6 months ago

Nice for you, and depending on how you use the API it might work, e.g. the sync part have not changed a lot.

But you are comparing versions of pymodbus, while this issue is about the same pymodbus version running with different versions of python, something quite different.

We compared pymodbus 2.5.3 async to 3.3 and the latter was around 3 times faster and a lot lighter on the cpu. We even offer a performance test tool.

pythcoiner commented 6 months ago

you use the API it might work, e.g. the sync part have not changed a lot.

But you are comparing versions of pymodbus, while this issue is about the same pymodbus version running with different versions of python, something quite different.

my last message was just for give a feedback

janiversen commented 5 months ago

Solved on dev.