platformatic / ssr-performance-showdown

Let's evaluate the performance of SSR libraries
Apache License 2.0
73 stars 29 forks source link

Fastify-html whitespace issue #27

Open pstachula-dev opened 2 weeks ago

pstachula-dev commented 2 weeks ago

I found a big problem with whitespace characters, which increase the size of the final server response by 25% (197kb vs 149kb)

With this change, I increased the average number of requests from 968req/s to 1033req/s.

 return reply.html`<div id="wrapper">
      !${tiles.map(({ x, y }) => (
        server.html`<div class="tile" style="left: ${x.toFixed(2)}px; top: ${y.toFixed(2)}px"></div>`
      ))}
    </div>`
mcollina commented 1 week ago

cc @gurgunday

gurgunday commented 1 week ago

Yeah, seems like it really helped for this benchmark, normally a compressor like brotli or gzip would help as well

Not sure if adding a minifier would make it faster or slower in the end

pstachula-dev commented 1 week ago

Minifer should be made in the new compilation step, like all other frameworks, but this introduces a new step, so the issue of DX vs. Perf.

gurgunday commented 1 week ago

Oh yeah, I see, and I can actually imagine it in fastify-html or ghtml one day if we can make it simple enough