{"size": 925, "ext": "js", "max_stars_repo_path": "benchmarks/creatingManyChildViews.js", "max_stars_repo_name": "wawjr3d/brisket", "max_stars_repo_stars_event_min_datetime": "2015-01-06T11:32:50.000Z", "max_stars_repo_stars_event_max_datetime": "2017-12-18T05:29:23.000Z", "max_issues_repo_path": "benchmarks/creatingManyChildViews.js", "max_issues_repo_name": "wawjr3d/brisket", "max_issues_repo_issues_event_min_datetime": "2015-01-18T04:26:26.000Z", "max_issues_repo_issues_event_max_datetime": "2017-09-30T03:42:03.000Z", "max_forks_repo_path": "benchmarks/creatingManyChildViews.js", "max_forks_repo_name": "wawjr3d/brisket", "max_forks_repo_forks_event_min_datetime": "2015-01-14T15:19:21.000Z", "max_forks_repo_forks_event_max_datetime": "2017-11-15T05:22:34.000Z"}
{"max_stars_count": 808, "max_issues_count": 174, "max_forks_count": 81, "avg_line_length": 21.0227272727, "max_line_length": 64, "alphanum_fraction": 0.5513513514}
"use strict";

const Benchmark = require("benchmark");
const prettyOutput = require("beautify-benchmark");
const BrisketTesting = require("../testing");
const View = require("../lib/viewing/View");

const ParentView = View.extend();
const ChildView = View.extend();

BrisketTesting.setup();

const parentView = new ParentView();

const suite = new Benchmark.Suite("Creating many child views", {
    onStart() {
        /* eslint-disable no-console */
        console.log(`${ this.name }:`);
    }
});

suite
    .add({
        name: "with simple View",
        maxTime: 2,
        "fn": function() {
            let i = 100;

            while (i > 0) {
                parentView.createChildView(ChildView);

                i--;
            }
        }
    })

    .on("cycle", function(event) {
        prettyOutput.add(event.target);
    })
    .on("complete", function() {
        prettyOutput.log();
    })
    .run();
