<commit_before><?php
declare(strict_types=1);

namespace Sokil\IsoCodes\Databases;

use Sokil\IsoCodes\Database\Subdivisions;
use Sokil\IsoCodes\Database\SubdivisionsPartitioned;
use Sokil\IsoCodes\IsoCodesFactory;

class SubdivisionsBench
{
    public function databaseProvider(): array
    {
        return [
            'non_partitioned' => [
                'database' => Subdivisions::class
            ],
            'partitioned' => [
                'database' => SubdivisionsPartitioned::class,
            ],
        ];
    }

    /**
     * @ParamProviders({"databaseProvider"})
     * @Revs(100)
     * @Iterations(1)
     */
    public function benchIterator(array $params): void
    {
        (new $params['database'])->toArray();
    }

    /**
     * @ParamProviders({"databaseProvider"})
     * @Revs(100)
     * @Iterations(2)
     */
    public function benchGetAllByCountryCode(array $params): void
    {
        (new $params['database'])->getAllByCountryCode('UA');
    }
}
<commit_msg>bench<commit_after><?php
declare(strict_types=1);

namespace Sokil\IsoCodes\Databases;

use Sokil\IsoCodes\Database\Subdivisions;
use Sokil\IsoCodes\Database\SubdivisionsPartitioned;
use Sokil\IsoCodes\IsoCodesFactory;

class SubdivisionsBench
{
    public function databaseProvider(): array
    {
        return [
            'non_partitioned' => [
                'database' => Subdivisions::class
            ],
            'partitioned' => [
                'database' => SubdivisionsPartitioned::class,
            ],
        ];
    }

    /**
     * @ParamProviders({"databaseProvider"})
     * @Revs(100)
     * @Iterations(1)
     */
    public function benchIterator(array $params): void
    {
        (new $params['database'])->toArray();
    }

    /**
     * @ParamProviders({"databaseProvider"})
     * @Revs(100)
     * @Iterations(2)
     */
    public function benchGetByCode(array $params): void
    {
        (new $params['database'])->getByCode('UA-43');
    }

    /**
     * @ParamProviders({"databaseProvider"})
     * @Revs(100)
     * @Iterations(2)
     */
    public function benchGetAllByCountryCode(array $params): void
    {
        (new $params['database'])->getAllByCountryCode('UA');
    }
}

{'fraction_non_alphanumeric': 0.14432989690721648, 'fraction_numerical': 0.010757507844016136, 'mean_word_length': 2.4712286158631414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '103889', 'n_tokens_mistral': 718, 'n_tokens_neox': 706, 'n_words': 96}