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

[enhancement] Compute minting setup parameters in parallel #191

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steveluscher
Copy link

@steveluscher steveluscher commented Dec 11, 2021

Description

When the user clicks the mint button, we do four small async operations to set up the transaction. Despite the fact that none of these transactions depend on one another, we've written them to be executed in series.

const foo = await getFoo();
const bar = await getBar();
const baz = await getBaz();
const bat = await getBat();

Instead, what we can do is to generate all of the promises at once, let the network IO start, and wait on the results as a group.

const [foo, bar, baz, bat] = await Promise.all([
  getFoo(),
  getBar(),
  getBaz(),
  getBat(),
]);

This isn't going to result in a huge speedup, since most of the async work here is CPU bound and not network bound, but it's a good habit to get into none the less.

Type of change

  • Enhancement

How Has This Been Tested?

I loaded up the site locally and minted several tokens on devnet.

@steveluscher steveluscher changed the title [enhancement] Speed up minting by parallelizing setup [enhancement] Compute minting setup parameters in parallel Dec 11, 2021
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