platformOS Community

Best server side page render performance?

Rich - One Orange Cow Apr 15 2021 at 07:24

This is server side (ONLY) pure performance question, no "what you think is better" or "best practice" or "Best of SEO"... I want to know what is the fastest render from the POS liquid engine... yes I could run my own tests but someone else might already know :)

{% liquid
	assign test = "test"
	assign test2 = "test2"
%}
{%- liquid
	assign test = "test"
	assign test2 = "test2"
-%}
{% assign test = "test" %}
{% assign test2 = "test2" %}
{%- assign test = "test" -%}
{%- assign test2 = "test2" -%}

The reason I came up with this is that {%- trims whitespace, but I don't know if this is done is realtime or done in the backend somehow.

Obvious there is not going to be much difference, but wanted to squeeze as much time saving as possible.

Thanks!

Pawel Apr 15 2021 at 08:00

I would say there is no difference in rendering, because assignment doesn't render anything, and whitespace isn't impacting rendering in any substantial way.

You can verify my guess by using our submillisecond measuring tool: time_diff

Here's how you can do it: https://documentation.platformos.com/best-practices/backend-performance/measuring-execution-time-liquid-time-diff

We have never got to the point where we would even consider optimizing liquid syntax (its called premature optimization for a reason) - there is always much bigger fish to fry: DB calls, loops, frontend, caching, lazyloading.

  • Rich - One Orange Cow Apr 15 2021 at 12:09
    Thanks for the quick reply, I'm more looking to do it all... or at least shave time whereever possible on all fronts... I'll do some testing and report my findings if no one else has done anything.
Please sign in or fill up your profile to answer a question