4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Gauging efficiency...
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Tue May 07, 2002 12:17 pm (21 years, 11 months ago) Reply with QuoteBack to Top

Is there a good way of gauging how efficent (or not) a script is, especially ones involving database calls?

I can get things to work, but being self taught at PHP I'm never sure whether I'm doing things in the best way Confused
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Peter
Team Member



Joined: 09 Jan 2002
Posts: 147
Location: UK

PostPosted: Wed May 08, 2002 3:44 pm (21 years, 11 months ago) Reply with QuoteBack to Top

There's a very nice benchmark/timer class in pear (find it in the cvs @ [url]cvs.php.net[/url] under pear -> Benchmark_Timer) which works well. Takes a little bit of getting used to though Smile

Peter.

________________________________
Maple Design - quality web design and custom programming
OfflineView User's ProfileFind all posts by PeterSend Personal MessageVisit Poster's WebsiteYahoo MessengerICQ Number
Garth Farley
WebHelper
WebHelper


Joined: 08 Jan 2002
Posts: 69
Location: Ireland

PostPosted: Thu May 09, 2002 9:12 am (21 years, 11 months ago) Reply with QuoteBack to Top

You can call microtime() at the beginning and end of the program, and find the difference between the two.

I think this tutorial has everything you need Timing Script Execution from PHPBuilder.com

Garth Farley
OfflineView User's ProfileFind all posts by Garth FarleySend Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Thu May 09, 2002 9:30 am (21 years, 11 months ago) Reply with QuoteBack to Top

Garth Farley wrote:
You can call microtime() at the beginning and end of the program, and find the difference between the two.

I think this tutorial has everything you need Timing Script Execution from PHPBuilder.com

Garth Farley


Trouble with that is you only have yourself as a benchmark, I guess it would be useful for seeing if you have improved something though.

I'm thinking there is no easy answer, accept do a bit more reading, learning and practicing and of course visiting this forum Laughing
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Garth Farley
WebHelper
WebHelper


Joined: 08 Jan 2002
Posts: 69
Location: Ireland

PostPosted: Thu May 09, 2002 4:02 pm (21 years, 11 months ago) Reply with QuoteBack to Top

A more useful thing to have implimented is for the page to update a log on how long each page executes. Then you can consult the log regurally to see if things are slowing up or what. MySql can be unpredictable, qeuries are queued, the system processor can be tied up with other things, there are many variables.

To see if a new request is better than others, run the PHP script a few times, and get the average of the values. This is a more accurate way of testing page times.

Garth Farley
OfflineView User's ProfileFind all posts by Garth FarleySend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.19593 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme