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

notes example app is slow #173

Open
danielbush opened this issue Oct 12, 2023 · 0 comments
Open

notes example app is slow #173

danielbush opened this issue Oct 12, 2023 · 0 comments

Comments

@danielbush
Copy link

Have you experienced this bug with the latest version of the template?

yes

Steps to Reproduce

(1) Run npx create-remix@latest --template remix-run/grunge-stack today

Screenshot 2023-10-12 at 4 40 35 pm

(2) npm run dev (which runs remix dev --manual -c "arc sandbox -e testing")

(3) Sign up with an email and password from the home page.

(4) view and add notes using the notes app

(5) observe the speed of page loads for the notes app and generally

Expected Behavior

All routes should be "fast" especially since it is using a local sandbox and is a demo app to get people started.

Actual Behavior

The notes routes and the sign up route feel sluggish, here's my network tab:

Screenshot 2023-10-12 at 4 31 45 pm

I added some console timings around some things, one thing I'm seeing is in app/models/note.server.ts

export async function getNoteListItems({
  userId,
}: Pick<Note, "userId">): Promise<Array<Pick<Note, "id" | "title">>> {
  console.time("all");
  console.time("arc.tables");
  const db = await arc.tables();
  console.timeEnd("arc.tables");

  console.time("db.note.query");
  const result = await db.note.query({
    KeyConditionExpression: "pk = :pk",
    ExpressionAttributeValues: { ":pk": userId },
  });
  console.timeEnd("db.note.query");
  console.timeEnd("all");

  return result.Items.map((n: any) => ({
    title: n.title,
    id: skToId(n.sk),
  }));
}

arc.tables timing is about 1.3s
db.note.query timing is about 0.9s
all timing is about 2.23s

Curious if anyone else can replicate it. I guess I can't rule out something weird with my network. I do have a vpn for work but I tried with it turned off as well.

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

No branches or pull requests

1 participant