metacpan / metacpan-web

Web interface for MetaCPAN
http://metacpan.org
Other
413 stars 235 forks source link

https://metacpan.org/author/PERLANCAR takes a long time to display here. #1661

Open shlomif opened 8 years ago

shlomif commented 8 years ago

Hi all,

I am using firefox-45.0.1-3.mga6 on Mageia Linux x86-64 v6 and am connected to the Internet using Bezeq International with a 10 mega-bit downstream / 1 mega-bit upstream ADSL connection. Now, viewing https://metacpan.org/author/PERLANCAR takes a long time to load and Firefox complains about an unresponsive script.

Looking at the downloaded HTML page (using wget), it seems that it has some unnecessary markup bloat, e.g:

People have been complaining about the sizes of web pages becoming larger:

I'm willing to try to send some pull-requests to help rectify the situation on metacpan.org if there's some consensus that what I say has merit.

Regards, -- @shlomif

haarg commented 8 years ago

The real issue here is that there is a javascript function that converts the dates into a more friendly format. Looping through all of the dates to convert them is taking a lot of time. I haven't looked into how that function could be optimized.

shlomif commented 8 years ago

@haarg : thanks for your comment.

haarg commented 8 years ago

My last comment was incorrect. The actual slowdown is from the code that abbreviates the release name column. I don't believe we'll be able to fix that without losing some functionality, so I don't have a suggested fix at this time.

oalders commented 8 years ago

I guess we could look at paginating results for a page of this size.

gordon-fish commented 8 years ago

Would it not be worth considering doing the abbreviation conversion on the server side if that's what's slowing things down so much? Not everything is suitable for off-loading onto the client. Things like this would probably be far more efficiently handled by the server than in client-side js.

In fact, this seems to be the sort of trap that a lot of web-sites these days fall into: off loading too much onto the client-side. One of the primary goals of web-design used to be to have as uniform an experience across the board as possible, but from I've been seeing in the wild the past couple years, relying too much on the speed of the client-side can really hinder that.

People used to be able to just hand down an older computer for web-browser and email tasks, which were considered to be very light duty, but now it seems one needs an almost top of the line system to render some sites in a usable capacity.

ranguard commented 8 years ago

@gordon-fish how would the server side know the browser width and therefor where to chop the abstract at?

ranguard commented 8 years ago

I guess one could use JS to work it out, then set a cookie or something, and then have every page reload if the cookie isn't set - but that still requires JS and a lot of faffing around and the page would look broken as you resided the window, then you'd also have to change the cookie.. oh and reload the page if the size did change....

I get your point, somethings can/should be done server side... but this isn't one of them.

szr8 commented 8 years ago

@ranguard Could you please elaborate? If I load the page with and without JS enabled, the only difference I see if the Favorites table is not sorted in the former case (where the page loads instantly.)

ranguard commented 8 years ago

This bit here gets truncated depending on browser window size

perlancar__perlancar__-_metacpan org
gordon-fish commented 8 years ago

@ranguard That doesn't seem to be what's causing the slow down. From what I can tell it's the sorting of the Favorites table.

ranguard commented 8 years ago

Oh, well if thats it, then sounds like server side would be good - we love pull requests :)

haarg commented 8 years ago

@gordon-fish what are you basing that on?

The abbreviation that causes problems is the release names, not the abstract. It doesn't make sense at all to do in on the server.

kentfredric commented 7 years ago

@szr8 also, this part of the page is computed by some javascript brute force, and can't be done server-side because of font-metrics, proportional kerning[1] and rendering-engine specific behaviour:

elips

And this is a fine example why it needs to be infix shortening, not suffix shortening, as only the suffixes are different.

1: Proportional font not shown as I force a fixed-width one locally.