Wednesday, 16 September 2020

Does caching help to avoid the performance impact during server side rendering with Express framework because of mixins and JS code in Pug templates?

From Express documentation:

The view engine cache does not cache the contents of the template’s output, only the underlying template itself. The view is still re-rendered with every request even when the cache is on.

Honestly, I did not understand what caching doing for performance improving. So I'll ask directly about what I worry that could cause the performance impact. Does caching help to avoid the performance impact because of below mixin and/or JavaScript code?

mixin TestMixin(parameters)

  -
    const {
      hasIcon = false,
      contextClass
    } = parameters;

    // Some thousands lines of JavaScript code width parameters validation and computings ...

  div The content of this mixin could be arbitrarily large.

// ↑ Does caching reduce the performance impact because of above mixin initialization?
// (well, it's JavaScript "identifiers resolution")

In real project, instead of TestMixin could be several thousands of UI components, implemented in Pug mixins. I was not critical when I compiled pug to html locally, but I suppose the compiling Pug to html in real time in server side requires the reconsideration of Pug includes usage.



from Does caching help to avoid the performance impact during server side rendering with Express framework because of mixins and JS code in Pug templates?

No comments:

Post a Comment