|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| TestBenchmarkModule | calculate_sum (n) |
| Calculate the sum of all integers from 1 to n. | |
| TestBenchmarkModule | fibonacci (n) |
| Recursively compute the nth Fibonacci number. | |
| TestBenchmarkModule | process_data () |
| Process all stored numbers and return a doubled value array. | |
| TestBenchmarkModule calculate_sum | ( | n | ) |
Calculate the sum of all integers from 1 to n.
| n | (number) The upper bound of the summation range (inclusive). Must be a non-negative integer |
| TestBenchmarkModule fibonacci | ( | n | ) |
Recursively compute the nth Fibonacci number.
Uses naive recursive implementation without memoization. Performance degrades exponentially with larger values of n - avoid calling with n > 30 in performance-sensitive contexts. Base cases: fibonacci(0) = 0, fibonacci(1) = 1.
| n | (number) The zero-based index into the Fibonacci sequence. Must be a non-negative integer |
| TestBenchmarkModule process_data | ( | ) |
Process all stored numbers and return a doubled value array.
Iterates over the module's internal numbers table (populated at load time with squares of 1-100) and returns a new array where each value is doubled. The source data is read from TestBenchmarkModule.data.numbers and is not modified.