core icon indicating copy to clipboard operation
core copied to clipboard

Avatar images are slow to resolve

Open ringmaster opened this issue 12 years ago • 3 comments

I have not investigated why, but avatar images load slowly when I view the user page, especially when no image exists for a user. The code seems to present the placeholder "image" (background color with a letter) only after making the return trip to the server looking for the image. If many users are present and the server is small (can only handle a couple of simultaneous PHP requests), this takes quite a while and, oddly, doesn't seem to cache even when an avatar image does exist for a user.

Ideally, a single request (or the output of the template itself) could report the presence of images for all avatars present on the page at once, and then either make the serial requests for each image, which would be guaranteed to exist.

The avatar images, at least in local testing, seem to have a no-cache header attached, so the web client fetches them over again every time. This seems inefficient, where a per-session cache header would be more appropriate.

To give the appearance of speed on my local copy, I've moved the $div.imageplaceholder(user) call in jquery.avatar.js up prior to the $.get() call, so that a placeholder exists prior to replacing it with an image. The illusion of something being in that place makes it feel faster upon load. But a more fundamental review of how avatars are handled seems warranted.

ringmaster avatar May 20 '14 17:05 ringmaster

@Kondou-ger

PVince81 avatar May 22 '14 12:05 PVince81

This is recently fixed on master. We now only retrieve avatars for users that have avatars. On top of that we now show the placeholder first. Which should make it feel faster.

Caching of avatars is still something we should look at. But we must make sure the personal avatar is not cached.

Anyway the user page feels snappier now with the new code, so closing this.

rullzer avatar Dec 11 '15 19:12 rullzer

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Aug 07 '19 10:08 lock[bot]