Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 5 of 5

This is a discussion on Resource Usage etc in the Shared & Semi-Dedicated forum
I've just written a new script and to the best of my ability and knowledge I've made it as efficient as possible however I still ...

  1. #1
    Just Walking...
    Join Date
    Oct 2002
    Location
    England
    Posts
    436

    Resource Usage etc

    I've just written a new script and to the best of my ability and knowledge I've made it as efficient as possible however I still wonder if it might not be a little heavy on resources.

    Although I can't work out the max memory usages I do have a run-time clock in there which gives some indication of processor time used.

    Any guidelines (serious not just invented) which might be used to judge whether a script is too resource heavy?

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Well, as long as your script isn't taking an extremely long time to generate a resulting page, ou're probably fine. The programmer in my is always trying to make my code more and more efficient, but I've seen many publically available scripts that look terrible by my standards and still seem to perform fine on most web servers. If you scripts are too resource intensive, support will surely let you know.

    Seriously, though, how many different kinds of things does you script do (posting to databases,writing/reading files, etc)? As long as it isn't getting into any endless (or seemingly endless) looping, you're probably fine.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    Just Walking...
    Join Date
    Oct 2002
    Location
    England
    Posts
    436
    What would be considered extremely long?

    It's the not the entire script that concerns me but one probably lesser used function. It creates a family tree based on data from a database, I'm not a professional programmer but based on what my professional friends have discussed I'd say it's similier to a 'pathfind' program .. it descends down the tree from the head, it doesn't repeat any stages, so no excessive work but some degree of looping. It builds up a mutlidimensional array for the positioning of each individual within the tree.

    Of course the more people in the tree or the greater number of generations the more time/resources it is likely to consume. I've already got ideas in mind to limit it, should it be too resource intensive, but I'd like to find out first because those changes would reduce the usefullness of the function.

  4. #4
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    I'm surprised that Vin hasn't chimed in here yet. He's always one to point out how fast his site is even with all of the database overhead he has. I just looked at his site and it says he's got 122 queries going on the home page and it does come up pretty quick. Every query will slow down the page, of course, but as long as you only make one connection to the database (mysql_connect()) and make multiple queries on that connection, you probably won't have a problem.

    You have to "play it by ear" with these kinds of things. If you notice that its taking a noticable amount of time to generate a page then you might want to look at adding a limiter and/or tweaking your code a little better, but if it does its thing quickly then you probably don't need to worry.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  5. #5
    Just Walking...
    Join Date
    Oct 2002
    Location
    England
    Posts
    436
    Thanks Jason. Wanted some reassurance and you've given it.

    In fact it wasn't even the mysql queries that were of any worry, of course they add to the total overhead, it was the other bits. I'll make the tree function available on a limited basis to customers and see what impact it makes

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •