<commit_before>import time

from examples.game_of_life import GameOfLife, GOLExperiment
from xentica.utils.formatters import sizeof_fmt


models = [
    ("Conway's Life", GameOfLife, GOLExperiment),
]
num_steps = 10000


if __name__ == "__main__":
    for name, model, experiment in models:
        ca = model(experiment)
        start_time = time.time()
        for j in range(num_steps):
            ca.step()
            time_passed = time.time() - start_time
        speed = num_steps * ca.cells_num // time_passed
        print("%s: %s cells/s" % (name, sizeof_fmt(speed)))
        del ca<commit_msg>Add docstrings for performance check script. (#23, #27)<commit_after>"""Script to run performance check."""
import time

from examples.game_of_life import GameOfLife, GOLExperiment
from xentica.utils.formatters import sizeof_fmt


models = [
    ("Conway's Life", GameOfLife, GOLExperiment),
]
num_steps = 10000


if __name__ == "__main__":
    for name, model, experiment in models:
        ca = model(experiment)
        start_time = time.time()
        for j in range(num_steps):
            ca.step()
            time_passed = time.time() - start_time
        speed = num_steps * ca.cells_num // time_passed
        print("%s: %s cells/s" % (name, sizeof_fmt(speed)))
        del ca
{'fraction_non_alphanumeric': 0.10921766072811774, 'fraction_numerical': 0.010844306738962044, 'mean_word_length': 2.903323262839879, 'pattern_counts': {'":': 2, '<': 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': '2808755', 'n_tokens_mistral': 423, 'n_tokens_neox': 398, 'n_words': 111}