<commit_before>

var suite = new Benchmark.Suite( "bench",

    {
        onCycle: function( event, bench ){

            console.log(
                String( event.target ),
                ( event.target.stats.mean * 1000 ).toFixed(2) + " ms"
            );

            document.body.appendChild( document.createElement( 'br' ) );

            var titleDom = document.createElement( 'div' );
            titleDom.style.fontWeight = 'bold';
            titleDom.textContent = event.target.name;
            document.body.appendChild( titleDom );

            var msDom = document.createElement( 'div' );
            document.body.appendChild( msDom );
            msDom.textContent = ( event.target.stats.mean * 1000 ).toFixed(2) + " ms";

        },
        onComplete: function(){

            console.log( "Done" );

            document.body.appendChild( document.createElement( 'br' ) );

            var done = document.createElement( 'div' );
            done.style.fontWeight = 'bold';
            done.textContent = "Done";
            document.body.appendChild( done );

        },
        onError: function( e ){
            console.error( e );
        }
    }

);

var data = {
    "1crn": "../../data/__example__/1crn.pdb",
    "3dqb": "../../data/__example__/3dqb.pdb",
    "3l5q": "../../data/__example__/3l5q.pdb",
};

var loadingManager = new THREE.LoadingManager( function(){

    console.log( "data loaded" );
    suite.run( true );

});

var xhrLoader = new THREE.XHRLoader( loadingManager );

Object.keys( data ).forEach( function( name ){

    var url = data[ name ];

    xhrLoader.load( url, function( response ){

        data[ name ] = response;

    } );

} );




suite.add( '1crn parse',
    
    {
        fn: function(){
            pdbStructure.reset();
            pdbStructure._parse( data[ "1crn" ] );
        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
        }
    }

);

suite.add( '1crn autoBond',
    
    {
        fn: function(){
    
            pdbStructure.bondSet = new NGL.BondSet();
            pdbStructure.autoBond();

        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
            pdbStructure.parse( data[ "1crn" ] );
        }
    }

);


// suite.add( '3dqb parse',
    
//     {
//         fn: function(){
//             pdbStructure.reset();
//             pdbStructure._parse( data[ "3dqb" ] );
//         },
//         setup: function(){
//             var pdbStructure = new NGL.PdbStructure();
//         }
//     }

// );

// suite.add( '3dqb autoBond',

//     {
//         fn: function(){
    
//             pdbStructure.bondSet = new NGL.BondSet();
//             pdbStructure.autoBond();

//         },
//         setup: function(){
//             var pdbStructure = new NGL.PdbStructure();
//             pdbStructure.parse( data[ "3dqb" ] );
//         }
//     }

// );


// suite.add( '3l5q parse',
    
//     {
//         fn: function(){
//             pdbStructure.reset();
//             pdbStructure._parse( data[ "3l5q" ] );
//         },
//         setup: function(){
//             var pdbStructure = new NGL.PdbStructure();
//         }
//     }

// );

// suite.add( '3l5q autoBond',

//     {
//         fn: function(){
    
//             pdbStructure.bondSet = new NGL.BondSet();
//             pdbStructure.autoBond();

//         },
//         setup: function(){
//             var pdbStructure = new NGL.PdbStructure();
//             pdbStructure.parse( data[ "3l5q" ] );
//         }
//     }

// );




<commit_msg>FIX: run benchmarks async so that the browser can refresh the html<commit_after>

var suite = new Benchmark.Suite( "bench",

    {
        onCycle: function( event, bench ){

            console.log(
                String( event.target ),
                ( event.target.stats.mean * 1000 ).toFixed(2) + " ms"
            );

            document.body.appendChild( document.createElement( 'br' ) );

            var titleDom = document.createElement( 'div' );
            titleDom.style.fontWeight = 'bold';
            titleDom.textContent = event.target.name;
            document.body.appendChild( titleDom );

            var msDom = document.createElement( 'div' );
            document.body.appendChild( msDom );
            msDom.textContent = ( event.target.stats.mean * 1000 ).toFixed(2) + " ms";

        },
        onComplete: function(){

            console.log( "Done" );

            document.body.appendChild( document.createElement( 'br' ) );

            var done = document.createElement( 'div' );
            done.style.fontWeight = 'bold';
            done.textContent = "Done";
            document.body.appendChild( done );

        },
        onError: function( e ){
            console.error( e );
        }
    }

);

var data = {
    "1crn": "../../data/__example__/1crn.pdb",
    "3dqb": "../../data/__example__/3dqb.pdb",
    "3l5q": "../../data/__example__/3l5q.pdb",
};

var loadingManager = new THREE.LoadingManager( function(){

    console.log( "data loaded" );
    suite.run( true );

});

var xhrLoader = new THREE.XHRLoader( loadingManager );

Object.keys( data ).forEach( function( name ){

    var url = data[ name ];

    xhrLoader.load( url, function( response ){

        data[ name ] = response;

    } );

} );




suite.add( '1crn parse',
    
    {
        async: true,
        fn: function(){
            pdbStructure.reset();
            pdbStructure._parse( data[ "1crn" ] );
        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
        }
    }

);

suite.add( '1crn autoBond',
    
    {
        async: true,
        fn: function(){
    
            pdbStructure.bondSet = new NGL.BondSet();
            pdbStructure.autoBond();

        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
            pdbStructure.parse( data[ "1crn" ] );
        }
    }

);


suite.add( '3dqb parse',
    
    {
        async: true,
        fn: function(){
            pdbStructure.reset();
            pdbStructure._parse( data[ "3dqb" ] );
        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
        }
    }

);

suite.add( '3dqb autoBond',

    {
        async: true,
        fn: function(){
    
            pdbStructure.bondSet = new NGL.BondSet();
            pdbStructure.autoBond();

        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
            pdbStructure.parse( data[ "3dqb" ] );
        }
    }

);


suite.add( '3l5q parse',
    
    {
        async: true,
        fn: function(){
            pdbStructure.reset();
            pdbStructure._parse( data[ "3l5q" ] );
        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
        }
    }

);

suite.add( '3l5q autoBond',

    {
        async: true,
        fn: function(){
    
            pdbStructure.bondSet = new NGL.BondSet();
            pdbStructure.autoBond();

        },
        setup: function(){
            var pdbStructure = new NGL.PdbStructure();
            pdbStructure.parse( data[ "3l5q" ] );
        }
    }

);





{'fraction_non_alphanumeric': 0.15164104694640632, 'fraction_numerical': 0.009416978257859022, 'mean_word_length': 1.535814606741573, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, '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': '7524476', 'n_tokens_mistral': 2288, 'n_tokens_neox': 2199, 'n_words': 425}