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

Replace Json with Pickle Serialization #472

Merged
merged 29 commits into from
Nov 4, 2022
Merged

Replace Json with Pickle Serialization #472

merged 29 commits into from
Nov 4, 2022

Conversation

gaurav274
Copy link
Member

@gaurav274 gaurav274 commented Nov 3, 2022

  1. Replace JSON serialization with pickle serialization.
  2. Remove unnecessary logging, which was the bottleneck.
  3. Reduce the display.pprint_nest_depth of ndarray objects in batch

@gaurav274 gaurav274 marked this pull request as ready for review November 3, 2022 21:26
Copy link
Collaborator

@xzdandy xzdandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the comments. Overall LGTM

}
return json.dumps(obj, cls=BatchEncoder)
def serialize(self):
obj = {"frames": self._frames, "batch_size": len(self)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the usage for batch_size? Can we return PickleSerializer.serialize(self)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For cases where we omit some rows, at least batch_size tells the row count

@@ -79,3 +81,10 @@ def set_socket_io_timeouts(transport, seconds, useconds=0):
return True
except OSError:
return False


def serialize_message(message: str):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use typing.Any for the type hint of message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@gaurav274 gaurav274 merged commit fd5b353 into master Nov 4, 2022
@gaurav274 gaurav274 deleted the server-message branch November 4, 2022 07:07
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

Successfully merging this pull request may close these issues.

None yet

3 participants