time() & timeEnd()

/**
 * @param string $name
 * @return void
 *
 * This function is used to start a timer
 */
public static function time(string $name = 'Console') : void;

/**
 * @param string $name
 * @return void
 *
 * This function is used to end a timer
 */
public static function timeEnd(string $name = 'Console') : void;

Similar to JavaScript, you put time() and timeEnd() methods at the end of your code to measure the time spent on your code.

System::time();
System::timeEnd();

Output:

Time for Console: 5.0067901611328E-6

Last updated