Skip to content

Conversation

@ryoppippi
Copy link
Contributor

┌─────────┬──────────────┬─────────┬──────────────┬─────────┬───────────┬─────────────┬─────────────────────┐
│ (index) │ name         │ ops/sec │ average (ms) │ samples │ body (kb) │ duplication │ relative to vanilla │
├─────────┼──────────────┼─────────┼──────────────┼─────────┼───────────┼─────────────┼─────────────────────┤
│ 0       │ 'vanilla'    │ 7630    │ '0.131'      │ 76310   │ '123.25''x1.00'''                  │
│ 1       │ 'react'      │ 987     │ '1.013'      │ 9875    │ '97.28''x1.00''7.73 x slower'     │
│ 2       │ 'sveltekit'  │ 779     │ '1.283'      │ 7797    │ '184.46''x2.00''9.79 x slower'     │
│ 3       │ 'solid'      │ 767     │ '1.303'      │ 7676    │ '215.93''x2.00''9.95 x slower'     │
│ 4       │ 'remix'      │ 587     │ '1.701'      │ 5880    │ '189.10''x2.00''13.00 x slower'    │
│ 5       │ 'vue'        │ 378     │ '2.644'      │ 3783    │ '96.72''x1.00''20.19 x slower'    │
│ 6       │ 'nuxt'       │ 365     │ '2.737'      │ 3655    │ '97.57''x1.00''20.90 x slower'    │
│ 7       │ 'next-pages' │ 147     │ '6.777'      │ 1476    │ '187.67''x2.00''51.90 x slower'    │
│ 8       │ 'mfng'       │ 76      │ '13.145'     │ 761     │ '317.31''x2.50''100.39 x slower'   │
│ 9       │ 'next'       │ 63      │ '15.829'     │ 632     │ '284.64''x2.00''121.11 x slower'   │
└─────────┴──────────────┴─────────┴──────────────┴─────────┴───────────┴─────────────┴─────────────────────┘

@arthurfiorette
Copy link
Contributor

I think the purpose of this benchmark is to compare SSR implementations with Suspense. I know this can be a good baseline but somehow a async/suspense logic should be added before this can be actually compared to others...

Comment on lines +51 to +57
export async function buildHandler(){
return async function handler(_: IncomingMessage, res: ServerResponse) {
const { html } = await renderHtml()
res.setHeader("Content-Type", "text/html")
res.end(html)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part is something like async/suspense logic

Copy link
Contributor

Choose a reason for hiding this comment

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

It is a sync render. "Suspense logic" first renders a fallback html then hydrates it with the resolved content

Choose a reason for hiding this comment

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

You could hydrate a shadowroot. It allows for fallbacks content while waiting for the next chunk of the response to stream in:

<body>
  <div>
    <template shadowrootmode=open>
      <slot>Loading...</slot>
    </template>
    <!-- here some async work can happen -->
    ${renderTable()}
  </div>
</body>

Copy link
Contributor

Choose a reason for hiding this comment

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

Who's ready for yet another new framework?

Choose a reason for hiding this comment

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

a screen capture of the movie Back To the Future. Doc, Marty & Jennifer are all in the Delorean, and Doc is wearing futuristic shades. The caption says "frameworks?! where we're going we don't need frameworks!"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't get it. I think it's enough. Did you see the bundled result from Marko? It's nearly the same as mine.

@b3nten
Copy link

b3nten commented Apr 14, 2024

This should be added as a baseline. Frameworks adding overhead is not vanilla js's fault.

@ryoppippi
Copy link
Contributor Author

Thank you @b3nten !!
idk what's wrong with this PR.

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.

4 participants