Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: when adding txs to the pool, pre-compute the sender *before* locking the pool #73

Merged
merged 1 commit into from
Mar 15, 2018

Conversation

jmank88
Copy link
Contributor

@jmank88 jmank88 commented Mar 15, 2018

Sender calculation is costly. Don't do it while holding the lock - get it out of the way beforehand. The pool.signer never changes, so we don't need the lock to access it.

// Pre-compute and cache before locking.
for _, tx := range txs {
_, _ = types.Sender(ctx, pool.signer, tx)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add some fine grained parallelism here, like the state processor, but we already have a lot of higher level concurrency going on, and will only have more as the cluster size scales up.

@jmank88 jmank88 requested a review from treeder March 15, 2018 21:20
@jmank88 jmank88 merged commit 23e1b73 into master Mar 15, 2018
@jmank88 jmank88 deleted the pool-add-send branch March 15, 2018 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant