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

Mailbox should not constantly deserialize mesages. #275

Open
qnikst opened this issue Mar 1, 2016 · 3 comments
Open

Mailbox should not constantly deserialize mesages. #275

qnikst opened this issue Mar 1, 2016 · 3 comments

Comments

@qnikst
Copy link
Contributor

qnikst commented Mar 1, 2016

Current implementation of the CQueue and Match performs decoding on each check of the message, this is may be a huge performance hit for messages that are expensive to decentralize. We may implement solution that will memoise deserialization result.

We may use following approach:
Match could return 3 possible cases Matched a | Decoded b | NotMatch, where Matched a stands for match success, Decoded b stands for - fingerprint matches, but not message, in and deserialised value is returned, NotMatch stands for a case when fingerprint was not match or message is already decoded. Then CQueue implementation will alter CQueue and put decoded message instead of encoded.

It's possible to use Either a b instead where instead of NotMatch Left input will be returned, so queue will always be altered if message was not matched. However we need to check what approach will be cheaper.

CC: @dcoutts, @facundominguez.

@qnikst qnikst self-assigned this Mar 1, 2016
@qnikst qnikst added this to the distributed-process-0.7 milestone Mar 1, 2016
@facundominguez
Copy link
Contributor

Looks reasonable.

@hyperthunk
Copy link
Member

+1 - sounds reasonable to me too.

@hyperthunk
Copy link
Member

Looking at this, I want to understand decoded a bit better...

If we get a fingerprint match, we have to unencode (and that's coerce in the local case, don't forget), so that pattern matching or match-if can run. At that point if the match fails, Decoded b means we didn't match but we should update the queue record before continuing to search for a match, yes..?

So why does NoMatch stand for already decoded? That doesn't actually make sense to me...

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