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

Payload registry has to do a linear search to find payloads #9419

Open
bdraco opened this issue Oct 4, 2024 · 4 comments
Open

Payload registry has to do a linear search to find payloads #9419

bdraco opened this issue Oct 4, 2024 · 4 comments

Comments

@bdraco
Copy link
Member

bdraco commented Oct 4, 2024

note: we need zope.interface for more efficient adapter search

There is a note that its inefficent.

We might be able to clean it up by giving each payload a key as part of the base class and then doing a dict lookup instead

@Dreamsorcerer
Copy link
Member

We might be able to clean it up by giving each payload a key as part of the base class and then doing a dict lookup instead

Doesn't really work, because it works with isinstance checks, which could be a subclass or an abc. I thought about this previously and didn't think of any improvements. Not sure what zope.interface is though, might be worth looking into.

@bdraco
Copy link
Member Author

bdraco commented Oct 5, 2024

Maybe if we have a property that is a key thats the same for the subclassed object.. not sure if that will work. Needs some more thought.

@Dreamsorcerer
Copy link
Member

Not sure what you mean, the subclasses are e.g. subclass of bytes or (more realistically) a subclass of io.BufferedIO. They are not our classes, just arbitrary types that might be used to store/stream data.

@bdraco
Copy link
Member Author

bdraco commented Oct 5, 2024

I need to dig at it a bit more to come up with a solution. This one will take a bit of thought so I opened the issue so I don't forget to come back to it.

@github-staff github-staff deleted a comment Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants