function strategy_0() {
    var path = "", content = "";
    var t_1= 0, t_2 = 0, time_1 = 0, time_2 = 0;
    var count = 0, count_bytes = 0, skipped = 0, skipped_bytes = 0;
    var parse1_first = false;
    var list = os.file.listDir(dir);
    var ratios_2over1 = [];
    var parse1_first = true;
    for (var file of list) {
        path = os.path.join(dir, file);
        if (skipList.includes(path)) {
            continue;
        }
        content = "";
        try {
            // print(Math.round(100 * f / list.length), file);
            content = os.file.readRelativeToScript(path);
            parse1_first = !parse1_first; // Math.random() > 0.5;
            for (var i = 0; i < runs_per_script; i++) {
                // Randomize the order in which parsers are executed as they are
                // executed in the same process and the parsed content might be
                // faster to load for the second parser as it is already in memory.
                if (parse1_first) {
                    t_1 = parse_1(content);
                    t_2 = parse_2(content);
                } else {
                    t_2 = parse_2(content);
                    t_1 = parse_1(content);
                }
                time_1 += t_1;
                time_2 += t_2;
                ratios_2over1.push(t_2 / t_1);
            }
            count++;
            count_bytes += content.length;
        } catch (e) {
            // ignore all errors for now.
            skipped++;
            skipped_bytes += content.length;
            skipList.push(path);
        }
    }

    return {
        name1: name_1,
        name2: name_2,
        time1: time_1,
        time2: time_2,
        parsed_files: count * runs_per_script,
        parsed_bytes: count_bytes * runs_per_script,
        skipped_files: skipped * runs_per_script,
        skipped_bytes: skipped_bytes * runs_per_script,
        ratios_2over1: ratios_2over1,
    };
}
// parsers are effectively used on the main thread.
parsers are effectively used on the main thread.
parsers are effectively used on the main thread .
function strategy_0() {
    var path = "", content = "";
    var t_1= 0, t_2 = 0, time_1 = 0, time_2 = 0;
    var count = 0, count_bytes = 0, skipped = 0, skipped_bytes = 0;
    var parse1_first = false;
    var list = os.file.listDir(dir);
    var ratios_2over1 = [];
    var parse1_first = true;
    for (var file of list) {
        path = os.path.join(dir, file);
        if (skipList.includes(path)) {
            continue;
        }
        content = "";
        try {
            content = os.file.readRelativeToScript(path);
            parse1_first = !parse1_first; 
            for (var i = 0; i < runs_per_script; i++) {
                if (parse1_first) {
                    t_1 = parse_1(content);
                    t_2 = parse_2(content);
                } else {
                    t_2 = parse_2(content);
                    t_1 = parse_1(content);
                }
                time_1 += t_1;
                time_2 += t_2;
                ratios_2over1.push(t_2 / t_1);
            }
            count++;
            count_bytes += content.length;
        } catch (e) {
            skipped++;
            skipped_bytes += content.length;
            skipList.push(path);
        }
    }
    return {
        name1: name_1,
        name2: name_2,
        time1: time_1,
        time2: time_2,
        parsed_files: count * runs_per_script,
        parsed_bytes: count_bytes * runs_per_script,
        skipped_files: skipped * runs_per_script,
        skipped_bytes: skipped_bytes * runs_per_script,
        ratios_2over1: ratios_2over1,
    };
}
function strategy_0 ( ) { var path = "" , content = "" ; var t_1 = 0 , t_2 = 0 , time_1 = 0 , time_2 = 0 ; var count = 0 , count_bytes = 0 , skipped = 0 , skipped_bytes = 0 ; var parse1_first = false ; var list = os . file . listDir ( dir ) ; var ratios_2over1 = [ ] ; var parse1_first = true ; for ( var file of list ) { path = os . path . join ( dir , file ) ; if ( skipList . includes ( path ) ) { continue ; } content = "" ; try { content = os . file . readRelativeToScript ( path ) ; parse1_first = ! parse1_first ; for ( var i = 0 ; i < runs_per_script ; i ++ ) { if ( parse1_first ) { t_1 = parse_1 ( content ) ; t_2 = parse_2 ( content ) ; } else { t_2 = parse_2 ( content ) ; t_1 = parse_1 ( content ) ; } time_1 += t_1 ; time_2 += t_2 ; ratios_2over1 . push ( t_2 / t_1 ) ; } count ++ ; count_bytes += content . length ; } catch ( e ) { skipped ++ ; skipped_bytes += content . length ; skipList . push ( path ) ; } } return { name1 : name_1 , name2 : name_2 , time1 : time_1 , time2 : time_2 , parsed_files : count * runs_per_script , parsed_bytes : count_bytes * runs_per_script , skipped_files : skipped * runs_per_script , skipped_bytes : skipped_bytes * runs_per_script , ratios_2over1 : ratios_2over1 , } ; }
parsers are effectively used on the main thread.
parsers are effectively used on the main thread .
// print(Math.round(100 * f / list.length), file); // Math.random() > 0.5; // Randomize the order in which parsers are executed as they are // executed in the same process and the parsed content might be // faster to load for the second parser as it is already in memory. // ignore all errors for now.