PDA

View Full Version : Site slowness



dmantione
30-12-2006, 02:22 PM
Hi,

For me, PGD has always been a bit of a slow web site, with the CPU at 100% usage while the site is open. Probably because of the Javascripts running all the time. Since some recent changes, it really brings my desktop to a halt, where even typing or switching to different windows becomes slow. This is with Konqueror. With Opera things are much better, but Konq is my main browser. :?

I don't know if it is possible to tweak the Javascripts a bit?

Traveler
30-12-2006, 08:32 PM
Really? I've had PGD open on many pc's but never have I seen it make much use of the cpu, let alone a 100% use.

I'm not aware of your current configuration but I'm inclined to say your cpu problems are located elsewhere.

WILL
30-12-2006, 09:10 PM
Wow...

The JavaScript is probably one of the quicker parts of the site's code. I'd be happy to show you the code and see if you can't optimize it, if you want to give it a go. (if your able to work on my compiler of choice, I think you can handle a little JavaScript :lol: )

I do have to warn you though, it ain't pretty. You remember the days when 'HTML compression' was the new sliced bread? Well yeah, it goes there. :P But rest assured, it's not my code, but another's. ;)

There is a light(or lite for you pop/soda fans ;)) edition of the site planned for PDAs and what not, but that'll be some time from now.

dmantione
30-12-2006, 09:46 PM
Well, if it is not the Javascript it must be something else. Perhaps the news ticker or something. It must be caused by the background activity of the site. The X server suggests drawing, but minimizing the browser doesn't speed up the system. :(

http://www2.vhl.tudelft.nl/~daniel/100p.png

tux
30-12-2006, 11:04 PM
Yes, the news ticker at the top causes horrible slow down on some of the computers i have viewed the site on.

try using the subsilver theme and see if thats any faster (it doesnt have the news ticker)

WILL
31-12-2006, 12:48 AM
The News ticker is JavaScript. And it runs just fine on Mozilla browsers. Personally I recommend FireFox as it is the most functional browser availible on ALL platforms. (IE's non-standard exceptions not-with-standing)


This is the code for the newsbar function it's self:

<script>/*
========================================
NewsBar v1.2 &#40;modified to Forum Images NewsBar v1.02&#41;
License &#58; Freeware &#40;Enjoy it!&#41;
&#40;c&#41;2002 VASIL DINKOV- PLOVDIV, BULGARIA
========================================
NewsBar v1.2 was modified for forumimages.com by Daz and SamG.
Get the unmodified NewsBar script at&#58;
http&#58;//smartmenus.tripod.com/other.html
and don't wait to get the great SmartMenus script at&#58;
http&#58;//smartmenus.tripod.com

LEAVE THESE NOTES PLEASE - delete the comments if you want.
*/

/* Part 1&#58; content description - edit to suit */
var defaultText = '';
var newsBarContent = &#91;&#123;NEWS_BAR&#125;&#93;; // newsBarContent&#91;&#93; blocks must be in the format &#91;'href', 'text', 'target'&#93; and blocks must be separated by commas

/* Part 2&#58; "look and feel" variables - edit to suit */
var defaultTextTimeOut = 0; // the time the default text is displayed, in seconds
var newsBarTimeOut = 5; // the time a headline is displayed, in seconds
var newsBarSpeed = 20; // 1000 = 1 second
var leadingSign = '';
var newsBarStyle = 'style="position&#58; relative; font-size&#58; 12px;"';
var pauseNewsBarOnMouseOver = true; // true pauses NewsBar progress when mouse pointer is over links

/* Part 3&#58; the NewsBar engine - tinker in here at your own risk! */
var contentIndex = 0;
var cursorPosition = 0;
var textLength = newsBarContent&#91;0&#93;&#91;1&#93;.length;
var newsBarCycle = null;
defaultTextTimeOut *= 1000;
newsBarTimeOut *= 1000;
if &#40; pauseNewsBarOnMouseOver &#41; var eventHandlers = ' onmouseout="newsBarCycle = setTimeout&#40;\'newsBarNew&#40;&#41;\', ' + newsBarTimeOut + '&#41;;" onmouseover="clearTimeout&#40;newsBarCycle&#41;;">';
else var eventHandlers = '>';

function newsBarNew&#40;&#41; &#123;
if &#40; &#40;newsBarContent&#91;contentIndex&#93;&#91;0&#93; != ''&#41; && &#40;cursorPosition == textLength&#41; &#41; var text = '<a href="' + newsBarContent&#91;contentIndex&#93;&#91;0&#93; + '" target="' + newsBarContent&#91;contentIndex&#93;&#91;2&#93; + '"' + eventHandlers + newsBarContent&#91;contentIndex&#93;&#91;1&#93; + leadingSign + '</a>';
else var text = newsBarContent&#91;contentIndex&#93;&#91;1&#93;.substring&#40;0, cursorPosition&#41; + leadingSign;
document.getElementById&#40;'newsbar'&#41;.innerHTML = text;
if &#40; cursorPosition++ == textLength &#41; &#123;
cursorPosition = 0;
newsBarCycle = setTimeout&#40;'newsBarNew&#40;&#41;', newsBarTimeOut&#41;;
contentIndex++;
if &#40; contentIndex == newsBarContent.length &#41; contentIndex = 0;
textLength = newsBarContent&#91;contentIndex&#93;&#91;1&#93;.length;
&#125;
else setTimeout&#40;'newsBarNew&#40;&#41;', newsBarSpeed&#41;;
&#125;


And this is the code that is placed in the HTML to run it:

<script>
document.write&#40;'<div>' + defaultText + '</div>'&#41;;
setTimeout&#40;'newsBarNew&#40;&#41;', defaultTextTimeOut&#41;;</script>

savage
31-12-2006, 06:17 AM
If it's only a recent occurrence, could it be the RSS or Flash additions made recently?

dmantione
31-12-2006, 09:44 AM
If it's only a recent occurrence, could it be the RSS or Flash additions made recently?

Well as I said, PGD always used quite a bit of CPU power, however, I had to open quite a few windows before the system would start to respond slowly. Nowadays a single window makes the system already slow.


Yes, the news ticker at the top causes horrible slow down on some of the computers i have viewed the site on.

try using the subsilver theme and see if thats any faster (it doesnt have the news ticker)

That helps indeed.

WILL
31-12-2006, 09:46 AM
Yeah, the portal page definately would be the heavest thing that runs. It uses PHP's XML parser which runs through 4 different RSS files. (If I was successful though, not all the way through though.) But this has nothing to do with what your browser would be running.

I strongly recommend trying the site in other browsers; FireFox, IE, etc... see if there is not a boost in performance. Konqourer, afaiu(nderstand) was designed to be more of a local file browsing tool though rather than a great web browser. And though I do agree that it can and mostly does it's job fairly well, it's no FireFox or IE. :)

As far as the RSS stuff goes though, I have to admit though that it's not as optimized as it can be. And for some reason GameDev.net's RSS isn't giving me the top news item, which is an issue I will have to revisit soon.


Anyhow let us know how you make out with all that. I'll try out any optimizations you or anyone else can come up with provided that it doesn't kill the news ticker. ;)

dmantione
31-12-2006, 11:22 AM
Opera does a much better job than Konq on viewing PGD (15% cpu usage). However, I consider Konq the better browser. Perhaps just not for PGD.