<commit_before><?php

/**
 * This script uses the ezComponents Graph component to convert the raw CSV 
 * data generated by runner.php into SVG graph images.
 *
 * @link http://ezcomponents.org/docs/tutorials/Graph
 */

require 'ezc/Base/ezc_bootstrap.php';

$log = fopen('results/raw.csv', 'r');
fgetcsv($log);

$data = array(
    'memory' => array(),
    'rps' => array()
);

while ($line = fgetcsv($log)) {
    list ($elements, $file, $time, $rps, $memory) = $line;
    list ($component, $test) = explode('-', str_replace('.php', '', $file));
    $data['memory'][$component][$test][$elements] = ceil($memory / 1024); // convert to KB
    $data['rps'][$component][$test][$elements] = $rps;
}

fclose($log);

foreach ($data as $measurement => $components) {
    foreach ($components as $component => $tests) {
        echo $component, ' - ', $measurement, PHP_EOL;

        $graph = new ezcGraphBarChart;
        $graph->xAxis->label = 'Elements';
        $graph->yAxis->label = ($measurement == 'memory') ? 'Memory (KB)' : 'Requests / Second';
        $graph->title = $component . ' - ' . $measurement;
        foreach ($tests as $test => $elements) {
            $graph->data[$test] = new ezcGraphArrayDataSet($elements);
        }
        $graph->render(550, 225, 'results/' . $component . '_' . $measurement . '.svg');
    }
}<commit_msg>Reduced rendered graph dimensions slightly<commit_after><?php

/**
 * This script uses the ezComponents Graph component to convert the raw CSV 
 * data generated by runner.php into SVG graph images.
 *
 * @link http://ezcomponents.org/docs/tutorials/Graph
 */

require 'ezc/Base/ezc_bootstrap.php';

$log = fopen('results/raw.csv', 'r');
fgetcsv($log);

$data = array(
    'memory' => array(),
    'rps' => array()
);

while ($line = fgetcsv($log)) {
    list ($elements, $file, $time, $rps, $memory) = $line;
    list ($component, $test) = explode('-', str_replace('.php', '', $file));
    $data['memory'][$component][$test][$elements] = ceil($memory / 1024); // convert to KB
    $data['rps'][$component][$test][$elements] = $rps;
}

fclose($log);

foreach ($data as $measurement => $components) {
    foreach ($components as $component => $tests) {
        echo $component, ' - ', $measurement, PHP_EOL;

        $graph = new ezcGraphBarChart;
        $graph->xAxis->label = 'Elements';
        $graph->yAxis->label = ($measurement == 'memory') ? 'Memory (KB)' : 'Requests / Second';
        $graph->title = $component . ' - ' . $measurement;
        foreach ($tests as $test => $elements) {
            $graph->data[$test] = new ezcGraphArrayDataSet($elements);
        }
        $graph->render(400, 225, 'results/' . $component . '_' . $measurement . '.svg');
    }
}
{'fraction_non_alphanumeric': 0.19815837937384898, 'fraction_numerical': 0.007366482504604052, 'mean_word_length': 3.2906793048973144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '281661', 'n_tokens_mistral': 908, 'n_tokens_neox': 878, 'n_words': 210}