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

Poor handle_message performance #15

Closed
ssimeonov opened this issue May 17, 2014 · 3 comments
Closed

Poor handle_message performance #15

ssimeonov opened this issue May 17, 2014 · 3 comments

Comments

@ssimeonov
Copy link

handle_message is implemented such that the same JSON-encoded data would be parsed a minimum of 2 and a maximum of 4 times. Is there a particular reason for this choice?

@movitto
Copy link
Owner

movitto commented May 17, 2014

None other than it was quickest thing todo :-)

It might get parsed more times than that as two levels of parsing occur to determine message type (lib/rjr/node.rb#L186) and extract message contents in node.rb (lib/rjr/node.rb#L205) and each call to JSONParser results in two parser calls (lib/rjr/util/json_parser.rb#L89, see this for why this occurs: flori/json#182).

Agree that this should be optimized, on the TODO list, just haven't had cycles to do it. Would gladly accept any pr's you (or anyone else) wanted to submit

@movitto
Copy link
Owner

movitto commented Jun 14, 2014

@ssimeonov fixed with commit 2bacb30

Now json message is parsed only once and then analyzed from there.

@movitto movitto closed this as completed Jun 14, 2014
@ssimeonov
Copy link
Author

Great, Mo, this is a nice improvement.

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

No branches or pull requests

2 participants