<commit_before><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type="application/javascript">
        var keys = [],
                attrs = {};

        function createForEach( attrSpecs ){
            var statements = [ 'var v;' ];

            for( var name in attrSpecs ){
                statements.push( '(v=a.' + name + ')' + '===void 0||f(v,"' + name + '");');
            }

            return new Function( 'a', 'f', statements.join( '' ) );
        }

        for( var i = 0; i < 20; i++ ){
            keys.push( 'a' + i );
            attrs[ 'a' + i ] = i;
        }

        var compiled = createForEach( attrs );

        function Obj(){
            this.a0 = 0;
            this.a1 = 0;
            this.a2 = 0;
            this.a3 = 0;
            this.a4 = 0;
            this.a5 = 0;
            this.a6 = 0;
            this.a7 = 0;
            this.a8 = 0;
            this.a9 = 0;
            this.a10 = 0;
            this.a11 = 0;
            this.a12 = 0;
            this.a13 = 0;
            this.a14 = 0;
            this.a15 = 0;
            this.a16 = 0;
            this.a17 = 0;
            this.a18 = 0;
            this.a19 = 0;
        }

        var objAttrs = new Obj();

        function testC(){
            var count = 0;

            compiled( attrs, function( val ){ count+= val });
        }

        function testCObj(){
            var count = 0;

            compiled( objAttrs, function( val ){ count+= val });
        }

        function testLoop(){
            var count = 0;

            for( var i = 0; i < keys.length; i++ ){
                var name = keys[ i ],
                    val = attrs[ name ];

                if( val !== void 0 ){
                    count += val;
                }
            }
        }

        function testHash(){
            var count = 0;

            for( var name in attrs ){
                count += attrs[ name ];
            }
        }

        function testObj(){
            var count = 0;

            for( var name in objAttrs ){
                count += objAttrs[ name ];
            }
        }

        function measure( fun, count ){
            var start = window.performance.now();

            for( var i = 0; i < count; i++ ){
                fun();
            }

            console.log( window.performance.now() - start );
        }

        console.log( "Hash loop:" );
        measure( testHash, 1000000 );

        console.log( "Class loop:" );
        measure( testObj, 1000000 );

        console.log( "Array loop:" );
        measure( testLoop, 1000000 );

        console.log( "Unrolled loop:" );
        measure( testC, 1000000 );

        console.log( "Unrolled Obj loop:" );
        measure( testCObj, 1000000 );


    </script>

</body>
</html><commit_msg>updates test<commit_after><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type="application/javascript">
        var keys = [],
                attrs = {};

        function createForEach( attrSpecs ){
            var statements = [ 'var v;' ];

            for( var name in attrSpecs ){
                statements.push( '(v=a.' + name + ')' + '===void 0||f(v,"' + name + '");');
            }

            return new Function( 'a', 'f', statements.join( '' ) );
        }

        for( var i = 0; i < 20; i++ ){
            keys.push( 'a' + i );
            attrs[ 'a' + i ] = i;
        }

        var compiled = createForEach( attrs );

        function Obj(){
            this.a1 = 0;
            this.a2 = 0;
            this.a3 = 0;
            this.a4 = 0;
            this.a5 = 0;
            this.a6 = 0;
            this.a7 = 0;
            this.a8 = 0;
            this.a9 = 0;
            this.a10 = 0;
            this.a11 = 0;
            this.a12 = 0;
            this.a13 = 0;
            this.a14 = 0;
            this.a15 = 0;
            this.a16 = 0;
            this.a17 = 0;
            this.a18 = 0;
            this.a19 = 0;
            this.a20 = 0;
        }

        var objAttrs = new Obj();

        function testC(){
            var count = 0;

            compiled( attrs, function( val ){ count+= val });
        }

        function testCObj(){
            var count = 0;

            compiled( { a1 : 1 }, function( val ){ count+= val });
        }

        function testLoop(){
            var count = 0;

            for( var i = 0; i < keys.length; i++ ){
                var name = keys[ i ],
                    val = attrs[ name ];

                if( val !== void 0 ){
                    count += val;
                }
            }
        }

        function testHash(){
            var count = 0;

            for( var name in attrs ){
                count += attrs[ name ];
            }
        }

        function testObj(){
            var count = 0;

            for( var name in objAttrs ){
                count += objAttrs[ name ];
            }
        }

        function measure( fun, count ){
            var start = window.performance.now();

            for( var i = 0; i < count; i++ ){
                fun();
            }

            document.write( window.performance.now() - start );
        }

        document.write( "\nHash loop:\t" );
        measure( testHash, 1000000 );

        document.write( "\nClass loop:\t" );
        measure( testObj, 1000000 );

        document.write( "\nArray loop:\t" );
        measure( testLoop, 1000000 );

        document.write( "\nUnrolled loop:\t" );
        measure( testC, 1000000 );

        document.write( "\nUnrolled Obj loop:\t" );
        measure( testCObj, 1000000 );

    </script>

</body>
</html>
{'fraction_non_alphanumeric': 0.13962001045842776, 'fraction_numerical': 0.03468711870315496, 'mean_word_length': 1.1072346676459788, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 27, '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': '1731605', 'n_tokens_mistral': 1880, 'n_tokens_neox': 1648, 'n_words': 457}