Timer

hivecore.decorator.timer(in_milis: bool = True) Tuple[any, float]

A decorator that can measure how long a function takes to run.

Parameters:

in_milis (Optional[bool], optional) – A flag to determine if the result should be returned as milis or in seconds. Default: False

Returns:

Tuple of (function result, execution time)

Return type:

Tuple

Basic Example

from hivecore.decorator import timer

@timer
def suma(n):
    return sum(range(n))

suma(500000000)

In Miliseconds Example

from hivecore.decorator import timer

@timer(in_milis = True)
def suma(n):
    return sum(range(n))

suma(500000000)