Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

notes example app is slow #173

Open
Open
@danielbush

Description

@danielbush

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions