<commit_before>package pman;

import tannus.io.*;
import tannus.ds.*;
import tannus.graphics.Color;
import tannus.sys.*;
import tannus.TSys as Sys;
import tannus.async.*;
import tannus.html.Win;

#if renderer_process

import gryffin.core.*;
import gryffin.display.*;

import pman.core.*;
import pman.db.AppDir;
import pman.edb.*;
import pman.edb.PManDatabase;
import pman.display.ColorScheme;

#end

import tannus.math.TMath.*;
import foundation.Tools.*;

import haxe.extern.EitherType;

using StringTools;
using tannus.ds.StringUtils;
using Lambda;
using tannus.ds.ArrayTools;
using Slambda;

class Globals {
/* === Functions === */

    /**
      * get the current timestamp
      */
    public static inline function now():Float {
        return window.performance.now();
    }

    /**
      * invoke [f] after waiting [ms] milliseconds
      */
    public static inline function wait(ms:Int, f:Void->Void) {
        return js.Browser.window.setTimeout(f, ms);
    }

    /**
      * defer [f] to the next call stack
      */
    public static function defer(f : Void->Void):Void {
        tannus.node.Node.process.nextTick( f );
    }

    /**
      * defer [f] using Window.requestAnimationFrame
      */
    public static function animFrame(frame : EitherType<Void->Void, Float->Void>):Void {
        window.requestAnimationFrame(untyped frame);
    }

    public static inline function report(error : Dynamic):Void {
        (untyped __js__('console.error')( error ));
    }

/* === Computed Variables === */

#if renderer_process

    public static var bpmain(get, never):BPlayerMain;
    private static inline function get_bpmain() return BPlayerMain.instance;

    public static var player(get, never):Player;<commit_msg>added new 'measureTimeCost' method to pman.Globals<commit_after>package pman;

import tannus.io.*;
import tannus.ds.*;
import tannus.graphics.Color;
import tannus.sys.*;
import tannus.TSys as Sys;
import tannus.async.*;
import tannus.html.Win;

#if renderer_process

import gryffin.core.*;
import gryffin.display.*;

import pman.core.*;
import pman.db.AppDir;
import pman.edb.*;
import pman.edb.PManDatabase;
import pman.display.ColorScheme;

#end

import tannus.math.TMath.*;
import foundation.Tools.*;

import haxe.extern.EitherType;

using StringTools;
using tannus.ds.StringUtils;
using Lambda;
using tannus.ds.ArrayTools;
using Slambda;

class Globals {
/* === Functions === */

    /**
      * get the current timestamp
      */
    public static inline function now():Float {
        return window.performance.now();
    }

    /**
      * invoke [f] after waiting [ms] milliseconds
      */
    public static inline function wait(ms:Int, f:Void->Void) {
        return js.Browser.window.setTimeout(f, ms);
    }

    /**
      * defer [f] to the next call stack
      */
    public static function defer(f : Void->Void):Void {
        tannus.node.Node.process.nextTick( f );
    }

    /**
      * defer [f] using Window.requestAnimationFrame
      */
    public static function animFrame(frame : EitherType<Void->Void, Float->Void>):Void {
        window.requestAnimationFrame(untyped frame);
    }

    /**
      * measure the amount of time it took to execute [action]
      */
    public static function measureTimeCost(action : Void->Void):Float {
        var start = now();
        action();
        return (now() - start);
    }

    public static inline function report(error : Dynamic):Void {
        (untyped __js__('console.error')( error ));
    }

/* === Computed Variables === */

#if renderer_process

    public static var bpmain(get, never):BPlayerMain;
    private static inline function get_bpmain() return BPlayerMain.instance;

    public static var player(get, never):Player;
{'fraction_non_alphanumeric': 0.12576933369012577, 'fraction_numerical': 0.0, 'mean_word_length': 3.089715536105033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '766927', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1173, 'n_words': 298}