Munchkin code slowing site down? | Community
Skip to main content
Natalie_Skarzyn
Level 2
February 13, 2019
Question

Munchkin code slowing site down?

  • February 13, 2019
  • 3 replies
  • 6901 views

Now that our site has been switched to mobile-first Google indexing, speed has become even more important. In analyzing the load times of different page elements, the biggest (slowest) offenders are always Munchkin code. Obviously Munchkin is resource-intensive because of all the work it's doing, but we're wondering if anyone else seeing a similar issue, and have any recommendations to mitigate?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

SanfordWhiteman
Level 10
February 13, 2019

Let's not be alarmist now. It adds to FUD when an automated tool has merely reported "this network request is the slowest on your page". Something must always be the slowest, by definition.

Automated tools are not capable of determining whether the relative performance actually matters. The same goes for preposterous automated security checks.

On the other hand, it's not really true that Munchkin is doing a lot of "work". The load time refers to the time to (asynchronously) load the Munchkin bootstrapper and (again asynchronously) load the current Munchkin library. Neither of these loads has any user-facing impact at all, unless you're using an old-school onload (as opposed to DOMContentLoaded) event in some other essential JS, which is itself a bad practice.

A vital way to reduce the user-facing performance impact of Munchkin is to turn off click tracking (add class="mchNoDecorate" to links, or at least to most links). You must be acutely aware of the consequences of doing this.

Natalie_Skarzyn
Level 2
April 3, 2019

Hi Sanford, thanks for your response. I apologize if my question was unclear, I'm not talking about the user performance impact but rather the asynchronous load time that impacts the overall speed of our site as a search ranking factor. In some testing we performed of all the elements that load on a page, the top 9 longest load time offenders were all Munchkin (in an uncached browser representative of a first-time user), all taking between 7 and 12 seconds to completely load. From a user's perspective, everything would look normal, but it impacts our site performance especially on mobile which as you know is extremely important to Google's algorithm.

Just curious if anyone else is having similar issues and how they've addressed.

Thanks!

Alex_O_Regan
Level 2
July 30, 2019

Hey Natalie, Sanford,

My team is also in the process of measuring the performance of our website and have come to a similar conclusion regarding Munchkin's performance. Understandably, some of the functionality that leads to website slowdown is unavoidable for the script, such as the synchronous XHR requests that happen on link clicks. However simply switching off link-tracking isn't really a solution to this problem in my opinion.

I think the best possible way of reducing the front-end performance impact of these scripts is to attempt do more of the work in the back-end rather than in the front-end. For example, I don't need to track navigation with JS - it can be tracked in the backend when a GET request is received for a page, as long as I can communicate with a Marketo API to pass on the necessary info. Does such an API exist, is there documentation for it? Currently, the synchronous link tracking slows down every navigation on our website by up to 70%, which is huge, so being able to perform this outside of the client's machine would be incredibly powerful.

Best regards

Alex

Level 2
September 10, 2019

Hi Natalie,

Were you able to find a solution to your issue? We are experiencing a similar issue.

SanfordWhiteman
Level 10
September 10, 2019

Please be specific about what you have observed and how you are testing and supply your URL.