Answer the question
In order to leave comments, you need to log in
How to optimize content loading?
Good day. The site has a function that loads comments under posts.
When scrolling up to the last 20 comments, the function loads new ones (150), etc.
Because there can be a million or more of these comments, then huge "friezes" appear.
Sob-sno, the question is: are there ready-made mechanisms to optimize this? It makes no difference in what programming language it is implemented, the main thing is that the logic is clear and does not present any difficulties in rewriting it in JS.
I tried to "splash" something of my own, it seems to work, but there are bugs. The brain boils, I ask for help.
Answer the question
In order to leave comments, you need to log in
If users "twist" the mouse wheel so much, maybe it's better to do a normal search on the comments? Or a filter with flexible conditions. Then they will spin less, and a million will be reduced to 100 pieces all of a sudden.
In the general case, you need to understand why the friezes. And optimize this place. Maybe you just don't have enough memory and the swap starts. Or you have every second iteration of all comments (for some reason, this is an example).
That is, you need to understand where you have the complexity of the algorithm O (N) or God forbid O (N 2 ).
select top 1 keys from (
SELECT RelPage_Y AS RP
FROM Keys
WHERE (((Keys.mp_group)=388))
UNION ALL SELECT RelPage_G AS RP
FROM Keys
WHERE (((Keys.mp_group)=388))
)
group by RP
order by count(RP) desc
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question