Replies: 4 comments
-
Ever since it released htmx, I've been having issues with slow speeds(htmx-demo repo), my solution was to set production mode to .env, and that made the speed increase dramatically. |
Beta Was this translation helpful? Give feedback.
-
Yes with Turning off the View collector even in development mode the speed is good. |
Beta Was this translation helpful? Give feedback.
-
Oh nice find! I just tried and yes, it makes Chrome so much nicer to use now :) Thanks for reporting. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the feedback guys! I added a note to the troubleshooting section: https://michalsn.github.io/codeigniter-htmx/troubleshooting/#slow-content-swapping |
Beta Was this translation helpful? Give feedback.
-
As mentioned a few times now (#137, #167), there is a problem with slow content swapping with htmx. At least this is what I was able to observe.
What I mean, is that this is not a problem of the slow queries (at least not yet) or slow markdown parsing. Why do I think so? Because the "pure" request times are relatively low and don't get different from times when we do full page reloads (which are fast).
Today I probably had a little "eureka" moment. I had a view file that I divided into smaller ones to be able to load them separately.
After this change, I immediately noticed that loading times went down... and to be exact, not the request times, but the time after which the content is visually replaced.
My first thought was - maybe something was wrong with the optimization of loading multiple view files... But a regular request, without htmx did not provide the same slow results. The speed was flawless.
Then I started thinking... You know how in development mode HTML comments are attached to views in the form of:
it turned out that they were responsible for the slow swapping of content on the page.
Turning off the View collector made the slow content-swapping problem go away. The conclusion is that it's these HTML comments that hinder content parsing and delay content swapping.
So I have a favor - if you observe slow content swapping during requests using htmx, try disabling the View collector and see if that solves the problem.
Beta Was this translation helpful? Give feedback.
All reactions