• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: RAM and CPU hogging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RAM and CPU hogging


  • Subject: Re: RAM and CPU hogging
  • From: Bill Briggs <email@hidden>
  • Date: Wed, 18 Jul 2007 12:08:17 -0300

At 8:56 AM +0100 7/18/07, Simon Forster wrote:
>On 17 Jul 2007, at 21:49, Timothy Hellum wrote:
>
>>The issue I am finding is that ARD tells me the machines are routinely running at 98% CPU and 98% RAM usage.  The problem is, the only apps running on them are the script (saved as an application), and Safari.  After a few days of running like this, they sort of seize up (wouldn't you?) and either present the beachball, time out on the Applescript, or freeze altogether.
>
>Like others, I'd bet on Safari. Try shutting down and restarting Safari after a period of time. This should free up any memory that Safari isn't releasing. Possibly the easiest way to achieve this would be to have a global counter and when it hits 720, quit Safari (delay a few seconds, then carry on with "activate, set URL...").

 You might also try a different browser. Here's your code adapted to iCab, which has a considerably smaller memory footprint than Safari.


set j to 1

on idle
global j
set lista to {"http://www.theglobeandmail.com";, "http://www.reportonbusiness.com/";, "http://www.globesports.com/"}
tell application "iCab"
Activate
OpenURL (item j of lista) toWindow -1
end tell
if j ¾ 2 then
set j to j + 1
else
set j to 1
end if
return 60
end idle



 It also has built-in HTML validation, so you can tell which of those sites of yours has HTML errors, supposing you want to do something about it. I just checked and there are over 100 HTML encoding errors on theglobeandmail.com. Ouch. The page source says it's HTML 4.01 Transitional, so I set that standard in iCab to check against. Since you work there, you might want to look at that.

 I just had a look at the source code for your newspaper's front page. I don't know what you do to generate that page, but it looks like a drunken monkey put it together. I saved the source in a file and numbered the lines. There are 2226 BLANK LINES in the source file *before* the code starts. Here's the chunk just before the beginning of the actual source code.


2224:
2225:
2226:
2227:	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
2228:	Transitional//EN"
2229:	   "http://www.w3.org/TR/html4/loose.dtd";>
2230:
2231:	<html lang="en-ca">
2232:	<head>
2233:		<title>globeandmail.com: Canada's National
2234:	Newspaper</title>
2235:

 I was so intrigued by this that I wrote a script to count the blank lines (including ones with non-printing characters). And there's more. There are 12770 paragraphs total in the source file, and while I know processor power is cheap, the page load is slowed by the parser having to deal with all of these empty lines (mostly a bunch of useless tabs and a few blank spaces). There are ** 11,317 ** of those blank lines! Someone in your IT or Web services group needs a kick in the pants. Every globe reader's HTML parser is having to deal with tens of thousands of blank or (mostly) tab-filled lines.

 So I wrote another script to strip out the lines that were blank or had just tabs and/or spaces. Guess what. The stripped page loads in less than half the time. The original source takes 12 seconds to *finish* loading in Safari on my PowerBook and the stripped source file finishes loading in 5 seconds.

 I think you guys at the globe have some cleanup work to do. I wouldn't accept a system that turned out source files that looked like that. It's degrading your readers' experience on the site.

- web
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: RAM and CPU hogging
      • From: Timothy Hellum <email@hidden>
References: 
 >RAM and CPU hogging (From: Timothy Hellum <email@hidden>)
 >Re: RAM and CPU hogging (From: Simon Forster <email@hidden>)

  • Prev by Date: RE: RAM and CPU hogging
  • Next by Date: Re: RAM and CPU hogging
  • Previous by thread: RE: RAM and CPU hogging
  • Next by thread: Re: RAM and CPU hogging
  • Index(es):
    • Date
    • Thread