Programming Large apps

I'm working on a large CGI application(when done will be around 6000 lines, not huge, but big enough). It accesses multiple MySQl databases and uses and object oriented design to run backends to access these databases. It also does file output operations, one run could do around 400 files running 400+ sql queries to retrieve information. I was curious if anyone had ideas so speed up the code. It's about three seconds, but...phew...thats too slow. It needs to be fast __WITHOUT__ MOD_PERL :). I'm already using strict, warning, and several other security options. I'm considering using goto to optimize once we're done coding...but I'd REALLY like to avoid it, even though I realize sometimes it's the fastes way to get things done. If anyone has any ideas I'd be greatful.

later,
Travis
-----------------------
"Thou shalt not follow the null pointer, for chaos and danger lie at its end!"
--C++ Commandments, 1st commandment

Comments

  • My comments are spread throughout stuff....

    : I'm working on a large CGI application(when done will be around 6000
    : lines, not huge, but big enough).
    I think that qualifies as big. ;-)

    : It accesses multiple MySQl databases and uses and object oriented
    : design to run backends to access these databases.
    OO design is often a Good Thing, but it isn't always great for performance.

    : It also does file output operations, one run could do around 400
    : files running 400+ sql queries to retrieve information.
    You are using multiple databases, but do you establish a seperate connection object for every one you connect do? Can you connect as one user with access to many databases to cut out the connection overhead (which is reasonably significant)?

    : I was curious if anyone had ideas so speed up the code. It's about
    : three seconds, but...phew...thats too slow. It needs to be fast
    : __WITHOUT__ MOD_PERL :). I'm already using strict, warning, and
    : several other security options. I'm considering using goto to
    : optimize once we're done coding...but I'd REALLY like to avoid it,
    : even though I realize sometimes it's the fastes way to get things
    : done. If anyone has any ideas I'd be greatful.
    Three seconds? Whew.... I'd love to know exactly what is taking that long. Maybe use Time::HiRes and time certain modules, or just time them for 1000 calls or something. Then you can see where it's slow. Knowing where to look in 60,000 lines of code will allow you to track down the real issues. I suspect database interaction may be taking the time if you're running 400+ queries.

    Are you able to cache output at all? So you generate something once and re-use it until it changes? May save you some time.

    Goto...ugh...Dijkstra wouldn't be liking that idea! ;-) And I'd expect the project will need to be maintained in the future too, and it will hinder that.

    BTW - is this the uElements project?

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • : My comments are spread throughout stuff....
    :
    : : I'm working on a large CGI application(when done will be around 6000
    : : lines, not huge, but big enough).
    : I think that qualifies as big. ;-)
    :
    : : It accesses multiple MySQl databases and uses and object oriented
    : : design to run backends to access these databases.
    : OO design is often a Good Thing, but it isn't always great for performance.
    :
    : : It also does file output operations, one run could do around 400
    : : files running 400+ sql queries to retrieve information.
    : You are using multiple databases, but do you establish a seperate connection object for every one you connect do? Can you connect as one user with access to many databases to cut out the connection overhead (which is reasonably significant)?
    :
    : : I was curious if anyone had ideas so speed up the code. It's about
    : : three seconds, but...phew...thats too slow. It needs to be fast
    : : __WITHOUT__ MOD_PERL :). I'm already using strict, warning, and
    : : several other security options. I'm considering using goto to
    : : optimize once we're done coding...but I'd REALLY like to avoid it,
    : : even though I realize sometimes it's the fastes way to get things
    : : done. If anyone has any ideas I'd be greatful.
    : Three seconds? Whew.... I'd love to know exactly what is taking that long. Maybe use Time::HiRes and time certain modules, or just time them for 1000 calls or something. Then you can see where it's slow. Knowing where to look in 60,000 lines of code will allow you to track down the real issues. I suspect database interaction may be taking the time if you're running 400+ queries.
    :
    : Are you able to cache output at all? So you generate something once and re-use it until it changes? May save you some time.
    :
    : Goto...ugh...Dijkstra wouldn't be liking that idea! ;-) And I'd expect the project will need to be maintained in the future too, and it will hinder that.
    :
    : BTW - is this the uElements project?
    :
    : Jonathan
    :
    : ###
    : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
    :
    :

    It's a portion of it, code isn't finished yet though. This is the news updater thingy, I only have around 2000 lines currently. I figured out what slowed it down finally. Partially my MySQL server, partially an error in a loop :)

    -----------------------
    "Thou shalt not follow the null pointer, for chaos and danger lie at its end!"
    --C++ Commandments, 1st commandment

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories