tvalentyn commented on a change in pull request #15901:
URL: https://github.com/apache/beam/pull/15901#discussion_r747064176



##########
File path: sdks/python/apache_beam/io/textio.py
##########
@@ -362,6 +391,15 @@ def _is_self_overlapping(delimiter):
         return True
     return False
 
+  def _is_escaped(self, read_buffer, position):
+    # Returns True if byte at position is preceded with an odd number
+    # of escapechar bytes or False if preceded by 0 or even escapes
+    # (the even number means that all the escapes are escaped themselves).
+    for current_pos in reversed(range(-1, position)):
+      if read_buffer.data[current_pos:current_pos + 1] != self._escapechar:

Review comment:
       I doubt that there is a significant performance impact, since we only 
have a condition after finding the delimiter. but of course you could try to 
run 
https://github.com/apache/beam/blob/9a44c9e6e1d944cc022d3e3e11b7ec08f7a3a790/.test-infra/jenkins/job_PerformanceTests_Python.groovy#L39
  or a similar experiment locally. Related: 
https://www.oreilly.com/library/view/c-coding-standards/0321113586/ch09.html




-- 
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]


Reply via email to