Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Stop waiting when adding to buffer
Browse files Browse the repository at this point in the history
Removed the wait when adding to an experience replay buffer. Since we
wait for concurrent processes to finish before every operation, there is
no need to wait for the experience replayer to finish adding to its
cache when `Add` is called. If another operation is called after `Add`
was called, that operation will wait until `Add` finishes running before
that operation runs. In other words, we were too concurrency safe
before. Now we are still concurrency safe, but the runtime has sped up.
  • Loading branch information
samuelfneumann committed Sep 24, 2021
1 parent 63a89e8 commit 159b63a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion expreplay/Default.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ func (d *defaultCache) Add(t timestep.Transition) error {
d.rewardCache[index] = t.Reward
d.discountCache[index] = t.Discount

d.wait.Wait()
d.currentInUsePos = (d.currentInUsePos + 1) % d.MaxCapacity()
return nil
}
1 change: 0 additions & 1 deletion expreplay/ExpReplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ func (c *cache) Add(t timestep.Transition) error {
c.rewardCache[index] = t.Reward
c.discountCache[index] = t.Discount

c.wait.Wait()
return nil
}

Expand Down

0 comments on commit 159b63a

Please sign in to comment.