-
Notifications
You must be signed in to change notification settings - Fork 90
Open
@hugovk
Description
Python 2 support was dropped in v0.12.0 (2021年01月01日).
Looks like much of this comment could be removed now? There is no longer self._start or self.compress in the file:
Lines 23 to 43 in fb6c715
# Note that starting in Python 3.4, deleting the initial n bytes from a
# bytearray is amortized O(n), thanks to some excellent work by Antoine
# Martin:
#
# https://bugs.python.org/issue19087
#
# This means that if we only supported 3.4+, we could get rid of the code here
# involving self._start and self.compress, because it's doing exactly the same
# thing that bytearray now does internally.
#
# BUT unfortunately, we still support 2.7, and reading short segments out of a
# long buffer MUST be O(bytes read) to avoid DoS issues, so we can't actually
# delete this code. Yet:
#
# https://pythonclock.org/
#
# (Two things to double-check first though: make sure PyPy also has the
# optimization, and benchmark to make sure it's a win, since we do have a
# slightly clever thing where we delay calling compress() until we've
# processed a whole event, which could in theory be slightly more efficient
# than the internal bytearray support.)
Originally posted by @hugovk in #114 (comment)
Metadata
Metadata
Assignees
Labels
No labels