←back to thread

165 points ksec | 1 comments | | HN request time: 0.325s | source
Show context
drumpkid ◴[] No.43549947[source]
I’m impressed by this project’s progress. It’s more than just a render library. Although they claim it’s 12x faster than ERB, but I couldn’t find their benchmark.
replies(1): >>43550166 #
fidrelity ◴[] No.43550166[source]
I believe it's referencing this: https://github.com/KonnorRogers/view-layer-benchmarks
replies(2): >>43550721 #>>43554054 #
byroot ◴[] No.43550721[source]
Can't believe this still has to be debunked. No Phlex certainly isn't 12x faster than ERB. It's noticeably slower than ERB, e.g.: https://github.com/KonnorRogers/view-layer-benchmarks/commit...

In some extreme scenarios with tons of very small partials, it can win against Action View because the Action View partial lookup is significant overhead.

replies(2): >>43551073 #>>43551432 #
1. joeldrapper ◴[] No.43551432[source]
In my experience, it’s not an extreme scenario to render several thousand components in a single view.

I think you’re looking at this from the perspective of having maybe a partial for your header and another for your footer. The way you build views in Phlex is you would have a component not just for the header but also the nav, each item in the nav, and each icon in each item.

We can argue about whether that level of abstraction and reuse is worth it, but the fact is ActionView gets very slow when you build views like that composing thousands of partials — and for people who want to build views like that, it matters.

Still, I think these “12× faster” comparisons are silly. If ActionView was just as fast at rendering thousands of small components, I’d still pick Phlex for the developer experience. I enjoy writing Ruby, not toggling between Ruby and HTML.