coding practice.....

Results 1 to 3 of 3

Thread: coding practice.....

  1. #1
    Join Date
    Dec 1969

    Default coding practice.....

    Just wondering what everyone thinks about this.<BR><BR>I have a function which gets called from a loop. Inside the function I create a filesystem object and a database object, use them to do stuff and destroy them. So everytime the function is called the server is having to create anbd destroy these objects. Is it better to create the required objects before the loop and destroy them after the loop has finished to reduce server process power?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: coding practice.....

    create it outside the function call and pass it in.

  3. #3
    Join Date
    Dec 1969

    Default Yep.

    Even if the server could pool FSO objects (which I am pretty sure it can&#039;t - only ADO), it would still have to find a free object in its pool, mark it as used, use it, then mark it as unused. That&#039;s on each iteration of the loop.<BR><BR>If it can&#039;t (which is most probable), it&#039;s having to load the DLL, allocate memory for the object, load the DLL, then unload the DLL and deallocate the memory. Again, on each iteration.<BR><BR>Creating it once and passing it around is the best solution in 99% of applications. Don&#039;t be fooled into storing anything in an application/session variable though - that would slow it RIGHT down.<BR><BR>Craig.

Posting Permissions

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