Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review performance testing #802

Open
ajgdls opened this issue Nov 2, 2022 · 3 comments
Open

Review performance testing #802

ajgdls opened this issue Nov 2, 2022 · 3 comments

Comments

@ajgdls
Copy link

ajgdls commented Nov 2, 2022

Hello, I've written a small Python module https://github.com/ajgdls/EPICSPyClientPerformance to compare the performance of 6 Python based EPICS clients. I have attempted to test each in a consistent way, and the README has some preliminary results for monitoring 1000 records at 10Hz for 1000 samples.

I would really appreciate it if this module owner would review EPICSPyClientPerformance test code for this client implementation to check that I'm actually testing in the correct and most efficient way. I would be happy to make updates that shows an increase in performance for this client.

This testing is driven by Diamond Light Source, and on 1st December the tests will be re-run against latest PyPI versions and then published (probably tech-talk) for further discussion, so if anyone wants to push performance optimisations they will get picked up on that date.

Thanks for taking a look, looking forward to hearing from everyone.

@tacaswell
Copy link
Collaborator

Lifting the code to here for easy of reading ;)

class CAProtoMonitor(MonitorClient):
    def __init__(self):
        super(CAProtoMonitor, self).__init__()
        self._subscriptions = []
        self._ctx = Context()

    def create_monitors(self):
        pvs = self._ctx.get_pvs(*self._pv_names)
        for pv in pvs:
            sub = pv.subscribe(data_type="time")
            sub.add_callback(self.callback)
            self._subscriptions.append(sub)

    def callback(self, sub, value):
        self.add_sample(
            sub.pv.name,
            value.data[0],
            value.metadata.timestamp,
            value.metadata.severity,
        )

    def close(self):
        for sub in self._subscriptions:
            sub.clear()
        self._ctx.disconnect()

This looks right to me.

@ajgdls
Copy link
Author

ajgdls commented Nov 3, 2022

Hi there, that's great thanks for you fast response.

@klauer
Copy link
Member

klauer commented May 18, 2023

So CPU usage is quite high, but surprisingly not the highest, somehow:
https://github.com/ajgdls/EPICSPyClientPerformance#example-test-result
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants