mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-29 19:42:51 +00:00
clist: speedup Next by removing defers (#2511)
This change doubles the speed of the mempool's reaping. Before: BenchmarkReap-8 5000 365390 ns/op 122887 B/op After: BenchmarkReap-8 10000 158274 ns/op 122882 B/op
This commit is contained in:
+3
-3
@@ -113,9 +113,9 @@ func (e *CElement) NextWaitChan() <-chan struct{} {
|
||||
// Nonblocking, may return nil if at the end.
|
||||
func (e *CElement) Next() *CElement {
|
||||
e.mtx.RLock()
|
||||
defer e.mtx.RUnlock()
|
||||
|
||||
return e.next
|
||||
val := e.next
|
||||
e.mtx.RUnlock()
|
||||
return val
|
||||
}
|
||||
|
||||
// Nonblocking, may return nil if at the end.
|
||||
|
||||
Reference in New Issue
Block a user