<commit_before><?php
/**
 * CloudLib :: Lightweight RESTful MVC PHP Framework
 *
 * @author      <NAME> <email>
 * @copyright   Copyright (c) 2011 <NAME> <email>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @package     cloudlib
 */

/**
 * <class name>
 *
 * <short description>
 *
 * @package     cloudlib
 * @subpackage  cloudlib.lib.classes
 * @copyright   Copyright (c) 2011 <NAME> <email>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class Benchmark
{
    /**
     * Array of start and stop times
     *
     * @access  public
     * @var     array
     */
    public static $times = array();

    /**
     * Constructor
     *
     * @access  public
     * @return  void
     */
    public function __construct() {}

    /**
     * Sets the start time
     *
     * @access  public
     * @return  void
     */
    public static function start($time)
    {
        if( ! isset(self::$times['start:' . $time]))
        {
            self::$times['start:' . $time] = static::getTime();
        }
    }

    /**
     * Sets the stop time
     *
     * @access  protected
     * @param   int     $time
     * @return  void
     */
    protected static function stop($time)
    {
        self::$times['stop:' . $time] = static::getTime();
    }

    /**
     * Gets the time
     *
     * @access  protected
     * @return  int
     */
    protected static function getTime()
    {
        list($usec, $sec) = explode(' ', microtime());

        return ((float) $usec + (float) $sec);
    }

    /**
     * Returns the load time rounded to 5 decimals
     *
     * @access  public
     * @return  int
     */
    public static function time($time, $round = 5)
    {
        static::stop($time);

        return round((static::$times['stop:' . $time] - static::$times['start:' . $time]), $round);
    }
<commit_msg>optimized, and added compare() function<commit_after><?php
/**
 * CloudLib :: Lightweight RESTful MVC PHP Framework
 *
 * @author      <NAME> <email>
 * @copyright   Copyright (c) 2011 <NAME> <email>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 * @package     cloudlib
 */

/**
 * <class name>
 *
 * <short description>
 *
 * @package     cloudlib
 * @subpackage  cloudlib.lib.classes
 * @copyright   Copyright (c) 2011 <NAME> <email>
 * @license     MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class Benchmark
{
    /**
     * Array of start and stop times
     *
     * @access  public
     * @var     array
     */
    public static $times = array();

    /**
     * Constructor
     *
     * @access  public
     * @return  void
     */
    public function __construct() {}

    /**
     * Sets the start time
     *
     * @access  public
     * @return  void
     */
    public static function start($time)
    {
        if( ! isset(self::$times['start:' . $time]))
        {
            self::$times['start:' . $time] = microtime(true);
        }
    }

    /**
     * Sets the stop time
     *
     * @access  protected
     * @param   int     $time
     * @return  void
     */
    protected static function stop($time)
    {
        self::$times['stop:' . $time] = microtime(true);
    }

    /**
     * Returns the load time rounded to 5 decimals
     *
     * @access  public
     * @return  int
     */
    public static function time($time, $round = 5)
    {
        static::stop($time);

        return round((static::$times['stop:' . $time] - static::$times['start:' . $time]), $round);
    }

    /**
     * Compare an already defined time with the current timestamp
     *
     * @access  public
     * @param   float   $time
     * @param   int     $round
     * @return  float
     */
    public static function compare($time, $round = 5)
    {
        return round((microtime(true) - (float) $time), $round);
    }

{'fraction_non_alphanumeric': 0.14898535833547394, 'fraction_numerical': 0.005394297456974056, 'mean_word_length': 1.9366515837104072, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5753828', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1196, 'n_words': 304}