91f630f70959098facef4ab4e1a98d1f48f9a586,streaming/python/collector.py,OutputCollector,collect,#OutputCollector#Any#,43

Before Change


    def collect(self, record):
        partitions = self._partition_func.partition(record,
                                                    len(self._channel_ids))
        serialized_message = pickle.dumps(record)
        for partition_index in partitions:
            self._writer.write(self._channel_ids[partition_index],
                               serialized_message)

After Change


        python_buffer = None
        cross_lang_buffer = None
        for partition_index in partitions:
            if self._target_languages[partition_index] == \
                    function.Language.PYTHON:
                // avoid repeated serialization
                if python_buffer is None:
                    python_buffer = self.python_serializer.serialize(record)
                self._writer.write(
                    self._channel_ids[partition_index],
                    serialization._PYTHON_TYPE_ID + python_buffer)
            else:
                // avoid repeated serialization
                if cross_lang_buffer is None:
                    cross_lang_buffer = self.cross_lang_serializer.serialize(
                        record)
                self._writer.write(
                    self._channel_ids[partition_index],
                    serialization._CROSS_LANG_TYPE_ID + cross_lang_buffer)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: ray-project/ray
Commit Name: 91f630f70959098facef4ab4e1a98d1f48f9a586
Time: 2020-04-28
Author: shawn.ck.yang@gmail.com
File Name: streaming/python/collector.py
Class Name: OutputCollector
Method Name: collect


Project Name: descarteslabs/descarteslabs-python
Commit Name: 92cb875784006cc358f7074e64a4028072b75417
Time: 2017-08-03
Author: kornelijus@descarteslabs.com
File Name: descarteslabs/services/metadata.py
Class Name: Metadata
Method Name: search


Project Name: descarteslabs/descarteslabs-python
Commit Name: 92cb875784006cc358f7074e64a4028072b75417
Time: 2017-08-03
Author: kornelijus@descarteslabs.com
File Name: descarteslabs/services/metadata.py
Class Name: Metadata
Method Name: summary