Skip to content

Commit

Permalink
functions/Buffer: Remove redundant parameter checks.
Browse files Browse the repository at this point in the history
The checks were as(more) expensive than the computation,
removing them gives ~7-9% performance improvement.
Signed-off-by: Jan Vesely <[email protected]>
  • Loading branch information
jvesely committed Sep 16, 2019
1 parent 9f094ee commit 5762e2c
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,7 @@ def _function(self,

# Apply rate and/or noise, if they are specified, to all stored items
if len(previous_value):
if any(np.atleast_1d(rate) != 1.0):
previous_value = previous_value * rate
if any(np.atleast_1d(noise) != 0.0):
previous_value = previous_value + noise
previous_value = previous_value * rate + noise

previous_value = deque(previous_value, maxlen=self.parameters.history._get(context))

Expand Down

0 comments on commit 5762e2c

Please sign in to comment.