[ 
https://issues.apache.org/jira/browse/BEAM-12781?focusedWorklogId=640833&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640833
 ]

ASF GitHub Bot logged work on BEAM-12781:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Aug/21 20:45
            Start Date: 23/Aug/21 20:45
    Worklog Time Spent: 10m 
      Work Description: pabloem commented on a change in pull request #15357:
URL: https://github.com/apache/beam/pull/15357#discussion_r694296420



##########
File path: sdks/python/apache_beam/io/iobase.py
##########
@@ -1573,15 +1581,28 @@ def is_bounded(self):
     return True
 
 
+class _RestrictionCoder(coders.Coder):

Review comment:
       done

##########
File path: sdks/python/apache_beam/io/iobase.py
##########
@@ -886,12 +888,18 @@ def get_desired_chunk_size(total_size):
 
   def expand(self, pbegin):
     if isinstance(self.source, BoundedSource):
+      coders.registry.register_coder(BoundedSource, _MemoizingPickleCoder)
       display_data = self.source.display_data() or {}
       display_data['source'] = self.source.__class__
+
+      def output_source(_) -> BoundedSource:
+        assert isinstance(self.source, BoundedSource)

Review comment:
       removed the function. (fwiw - I had used the assert to work around mypy 
complaining about types)

##########
File path: sdks/python/apache_beam/coders/coders.py
##########
@@ -741,6 +742,36 @@ def __hash__(self):
     return hash(type(self))
 
 
+class _MemoizingPickleCoder(_PickleCoderBase):
+  """Coder using Python's pickle functionality with memoization."""
+  def __init__(self, cache_size=16):
+    super(_MemoizingPickleCoder, self).__init__()
+    self.cache_size = cache_size
+
+  def _create_impl(self):
+    dumps = pickle.dumps

Review comment:
       makes sense. I've put pickler in, since the current use (`BoundedSource` 
elements) contains code and context.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 640833)
    Time Spent: 1h 10m  (was: 1h)

> SDFBoundedSourceReader behaves much slower compared with the original 
> behavior of BoundedSource
> -----------------------------------------------------------------------------------------------
>
>                 Key: BEAM-12781
>                 URL: https://issues.apache.org/jira/browse/BEAM-12781
>             Project: Beam
>          Issue Type: Bug
>          Components: io-py-common
>            Reporter: Pablo Estrada
>            Assignee: Pablo Estrada
>            Priority: P2
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to