Addon Info.
Optional Files (0)
Comments (1)
  Category: Developer Utilities
Addon Information
Download Latest Version.
To add favorites please register for a free account. If you already have one you need to login. How do I install this? (FAQ)
RaeVanMorlock's Portal Bug Reports Feature Requests
Author:
Version:
1.0
Date:
04-22-2007 09:18 PM
Size:
2.08 Kb
Downloads:
459
Views:
2,914
Favorites:
0
MD5:
Pictures
Click to enlarge
Sample code
Sample output
Benchmarker
Provides a class to create a Benchmarker that can be used to compare the execuation times of various functions. Benchmarker may be used in either World of Warcraft or within a standard LUA shell.

Usage Example
local tester = Benchmarker:new()
tester:AddFunction("Some Func", somefunc)
tester:AddFunction("Other Func", otherfunc)
tester:Run()


Notes
A global variable, Benchmark, is provided as a default Benchmarker class in case you'd like to create a test without instantiating a new class.

Class Definition

Instantiation

Benchmarker:new() - Returns a new Benchmarker class by setting the table's metamethod to the Benchmarker class and initializing some default properties

Properties

Benchmarker.TestIterations - (Default: 1) The number of times each function should be ran in a loop before calculating the total execution time.

Benchmarker.DisplayAfterRun - (Default: true) If true, the class's DisplayResults() method will be called at the end of the Run() method.

Methods

Benchmarker:AddFunction([name,] func) - Adds a function to the current list of functions that are going to be tested. Optionally, a name may be supplied to refer to this function as.

Benchmarker:Clear() - Clears the list of functions. Useful when wanting to create a new test with the same object.

Benchmarker:Run() - Runs the test. Each function is called a number of times and the total execution time is recorded.

Benchmarker:DisplayResults() - Provides a basic display of the results, including each functions total time and which function was the fastest
  Optional Files - Benchmarker
Sorry, there are currently no optional files available.
  Comments - Benchmarker
Post A Reply
Author Comments Comment Options
Old 04-23-2007, 11:11 AM  
Cladhaire
Salad!
 
Cladhaire's Avatar
WoWInterface Super Moderator
Interface Author - Click to view interfaces

Forum posts: 1028
File comments: 2044
Uploads: 12
I would suggest adding memory profiling as well, which often important when evaluating a piece of code.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

http://cladhaire.wowinterface.com
Cladhaire is online now Report comment to moderator   Edit/Delete Message Reply With Quote
Post A Reply



Category Jump:



The Network:
EQInterface | EQ2Interface | LoTROInterface | MMOInterface | War.MMOUI | WoWInterface | VGInterface | Allakhazam | Thottbot | Wowhead | Zam


MMOInterface.com Copyright ©2008
World of Warcraft is a registered Trademark of Blizzard Entertainment.
vBulletin - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.