core: reduce CPU load by reducing calls to checkQueue

* Reduced maxQueue count
* Added proper deletion past maxQueue limit
* Added cheap stats method to txpool

queueCheck was called for **every** transaction instead of:
1. add all txs
2. check queue

previously

1. add txs[i]
2. check queue
3. if i < len(txs) goto 1.
This commit is contained in:
Jeffrey Wilcke
2015-06-30 11:04:30 +02:00
parent 9226369b5d
commit 61ca780f3b
3 changed files with 54 additions and 28 deletions

View File

@ -68,8 +68,9 @@ func (self *txPoolApi) ApiVersion() string {
}
func (self *txPoolApi) Status(req *shared.Request) (interface{}, error) {
pending, queue := self.ethereum.TxPool().Stats()
return map[string]int{
"pending": self.ethereum.TxPool().GetTransactions().Len(),
"queued": self.ethereum.TxPool().GetQueuedTransactions().Len(),
"pending": pending,
"queued": queue,
}, nil
}