Skip to content

Commit 30a47b1

Browse files
committed
Update comment about bad performance of deque slicing
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 3a59bdd commit 30a47b1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/frequenz/sdk/timeseries/_resampling.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,12 @@ def resample(self, timestamp: datetime) -> Sample:
355355
# specifying a key extraction function in Python 3.10, so we need to
356356
# compare samples at the moment.
357357
cut_index = bisect(self._buffer, Sample(minimum_relevant_timestamp, None))
358-
# pylint: disable=fixme
359-
# FIXME: This is far from efficient, but we don't want to start new
360-
# ring buffer implementation here that uses a list to overcome the
361-
# deque limitation of not being able to get slices
358+
# Using itertools for slicing doesn't look very efficient, but
359+
# experiements with a custom (ring) buffer that can slice showed that
360+
# it is not that bad. See:
361+
# https://github.com/frequenz-floss/frequenz-sdk-python/pull/130
362+
# So if we need more performance beyond this point, we probably need to
363+
# resort to some C (or similar) implementation.
362364
relevant_samples = list(itertools.islice(self._buffer, cut_index, None))
363365
value = (
364366
conf.resampling_function(relevant_samples, conf.resampling_period_s)

0 commit comments

Comments
 (0)