<commit_before>#include <planet.h>
#include <planetsuniverse.h>
#include <chrono>

using namespace std::chrono;

#ifdef EMSCRIPTEN
int bench() {
#else
int main() {
#endif
    PlanetsUniverse universe;

    /* Use a constant seed for consistency. */
    universe.randSeed(0);

    /* Test a thousand steps. */
    universe.stepsPerFrame = 1000;

    size_t sizes[] = { 20, 100, 200, 500, 800 };

    for (size_t size : sizes) {
        universe.generateRandom(size, 1000.0f, 1.0f, 1000.0f);

        printf("Simulating %zu planets...\n", size);

        high_resolution_clock::time_point start = high_resolution_clock::now();

        universe.advance(10.0f);

        high_resolution_clock::time_point end = high_resolution_clock::now();

        auto delay = duration_cast<milliseconds>(end - start).count();

        printf("%i steps with %zu planets took %lims, average step time: %fms.\n", universe.stepsPerFrame, size, delay, delay / float(universe.stepsPerFrame));
        printf("Ended with %zu planets.\n", universe.size());

        fflush(stdout);

        /* Clear the thing for the next one. */
        universe.deleteAll();
    }

    return 0;
}<commit_msg>Bench: Reduce steps as planet count increases. (starts at 2000 now, and drops to 1000 by the end.) Format benchmark data in columns, and use double for time calculation.<commit_after>#include <planet.h>
#include <planetsuniverse.h>
#include <chrono>
#include <iostream>
#include <iomanip>

using namespace std;
using namespace std::chrono;

#ifdef EMSCRIPTEN
int bench() {
#else
int main() {
#endif
    PlanetsUniverse universe;

    /* Use a constant seed for consistency. */
    universe.randSeed(0);

    /* Start with a thousand steps. */
    universe.stepsPerFrame = 2000;

    size_t sizes[] = { 20, 100, 200, 500, 800 };

    /* Col:  |- 6-||-- 8--||---   16   ---||---   16   ---| doesn't matter,  Align left. */
    cout << "steps planets total time      average step    remaining planets" << left << endl;

    for (size_t size : sizes) {
        universe.generateRandom(size, 1000.0f, 1.0f, 1000.0f);

        cout << setw(6) << universe.stepsPerFrame
             << setw(8) << size;

        high_resolution_clock::time_point start = high_resolution_clock::now();

        universe.advance(10.0f);

        high_resolution_clock::time_point end = high_resolution_clock::now();

        double delay = duration_cast<duration<double, std::milli>>(end - start).count();

        cout << setw(16) << to_string(delay) + "ms"
             << setw(16) << to_string(delay / double(universe.stepsPerFrame)) + "ms"
             << universe.size() << endl;

        fflush(stdout);

        /* Clear the thing for the next one. */
        universe.deleteAll();

        /* Reduce the number of steps as the amount of planets increases. */
        universe.stepsPerFrame -= 250;
    }

    return 0;
}
{'fraction_non_alphanumeric': 0.1367908109989558, 'fraction_numerical': 0.03237034458753916, 'mean_word_length': 2.8116710875331563, 'pattern_counts': {'":': 0, '<': 40, '<?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': '5062381', 'n_tokens_mistral': 984, 'n_tokens_neox': 875, 'n_words': 248}