BaseElement
Functions
| Method | Returns | Description |
|---|---|---|
| BaseElement:startProfile | BaseElement | Starts timing a method call |
| BaseElement:endProfile | BaseElement | Ends timing a method call and records statistics |
| BaseElement:benchmark | BaseElement | Enables performance measurement for a method |
| BaseElement:logBenchmark | BaseElement | Logs benchmark statistics for a method |
| BaseElement:stopBenchmark | BaseElement | Disables performance measurement for a method |
| BaseElement:getBenchmarkStats | stats | Retrieves benchmark statistics for a method |
BaseElement:startProfile(methodName)
Starts profiling a method
Parameters
methodNamestringThe name of the method to profile
Returns
BaseElementselfThe element instance
BaseElement:endProfile(methodName)
Ends profiling a method
Parameters
methodNamestringThe name of the method to stop profiling
Returns
BaseElementselfThe element instance
BaseElement:benchmark(methodName)
Enables benchmarking for a method
Parameters
methodNamestringThe name of the method to benchmark
Returns
BaseElementselfThe element instance
Usage
element:benchmark("render")BaseElement:logBenchmark(methodName)
Logs benchmark statistics for a method
Parameters
methodNamestringThe name of the method to log
Returns
BaseElementselfThe element instance
BaseElement:stopBenchmark(methodName)
Stops benchmarking for a method
Parameters
methodNamestringThe name of the method to stop benchmarking
Returns
BaseElementselfThe element instance
BaseElement:getBenchmarkStats(methodName)
Gets benchmark statistics for a method
Parameters
methodNamestringThe name of the method to get statistics for
Returns
statsThebenchmark statistics or nil
Container
Extends: VisualElement
Functions
| Method | Returns | Description |
|---|---|---|
| Container:benchmarkContainer | Container | Recursively enables benchmarking |
| Container:logContainerBenchmarks | Container | Recursively logs benchmark statistics |
| Container:stopContainerBenchmark | Container | Recursively stops benchmarking |
Container:benchmarkContainer(methodName)
Enables benchmarking for a container and all its children
Parameters
methodNamestringThe method to benchmark
Returns
ContainerselfThe container instance
Usage
container:benchmarkContainer("render")Container:logContainerBenchmarks(methodName)
Logs benchmark statistics for a container and all its children
Parameters
methodNamestringThe method to log
Returns
ContainerselfThe container instance
Container:stopContainerBenchmark(methodName)
Stops benchmarking for a container and all its children
Parameters
methodNamestringThe method to stop benchmarking
Returns
ContainerselfThe container instance
Benchmark
This is the benchmark plugin. It provides performance measurement tools for elements and methods,with support for hierarchical profiling and detailed statistics. The plugin is meant to be used for very big projectswhere performance is critical. It allows you to measure the time taken by specific methods and log the results.
Functions
| Method | Returns | Description |
|---|---|---|
| Benchmark.start | - | Starts timing a custom operation |
| Benchmark.stop | - | Stops timing and logs results |
| Benchmark.getStats | stats | Retrieves benchmark statistics |
| Benchmark.clear | - | Removes a benchmark's data |
| Benchmark.clearAll | - | Removes all custom benchmark data |
Benchmark.start(name, options?)
Starts a custom benchmark
Parameters
namestringThe name of the benchmarkoptions(optional)tableOptional configuration
Benchmark.stop(name)
Stops a custom benchmark
Parameters
namestringThe name of the benchmark to stop
Benchmark.getStats(name)
Gets statistics for a benchmark
Parameters
namestringThe name of the benchmark
Returns
statsThebenchmark statistics or nil
Benchmark.clear(name)
Clears a specific benchmark
Parameters
namestringThe name of the benchmark to clear
Benchmark.clearAll()
Clears all custom benchmarks