eknkc / ssr-benchmark

Benchmarking JS web framework SSR performance
745 stars 172 forks source link

Add vanilla Svelte #6

Open Rich-Harris opened 1 month ago

Rich-Harris commented 1 month ago

Hey — I don't know if this is in keeping with the intent/spirit of the repo, so feel free to close, but since there's a vanilla React example in there I thought it'd be interesting to see what vanilla Svelte (i.e. without the overhead of SvelteKit's router) would look like. No streaming, since Svelte doesn't have a streaming SSR API.

image
eknkc commented 1 month ago

Yeah, this I also tried with similar results however just like #3 these might not be a good idea to introduce to the table as they will skew things a lot because they do sync rendering. I keep react because it handles promise resolution using Suspense boundaries, renders async (also interesting to see Next is 15x slower than that). Resolving the promise outside, I bet it will (along with vue) produce similar results.

jamonholmgren commented 1 month ago

IMO every competitor should be relative to React, even if faster -- so Svelte should show "Relative to React 6.22x faster".

(I know others will likely disagree, but since React is the industry leader, it makes sense to me.)

ryoppippi commented 1 month ago

Is there any differece between svelte4 and 5?

sheijne commented 1 month ago

@eknkc SvelteKit also does sync rendering. How is that different?

Isn't the whole idea behind this benchmark to benchmark SSR performance? And not how fast frameworks and renderers can stream/resolve promises?

Edit: Tested your theory, and it turns out it is incorrect. In the result below Suspense has been removed from the React and Vue benchmarks, and resolves the promise in the handler. Vue even appears to become slower.

image image
Inqnuam commented 1 month ago

Its totally unfair to compare React to SvelteKit when we can do SSR with plain Svelte. Thank you @Rich-Harris

ryoppippi commented 1 month ago

I'm on this PR