<commit_before>#pragma once

#include <string>
#include <iostream>
#include <iomanip>
#include "do_not_optimize.hpp"
#include "TimeHelpers.hpp"
#include "external/rang.hpp"

template <class Func>
double Benchmark(Func f, int numtimes = 2)
{
// 	f(); //warm up
	dscr::Chronometer C;
	for (int i = 0; i < numtimes; ++i)
	{
		f();
	}
	double avg = C.Reset()/numtimes;
	
	return avg;
}

template <class Container>
double FWIterationBenchmark(const Container& A)
{
	return Benchmark([&A]()
	{
		for (auto& a : A)
		{
			DoNotOptimize(a);
		}
	});
	
}

template <class Container>
double ReverseIterationBenchmark(const Container& A)
{
	return Benchmark([&A]()
	{
		for (auto it = A.rbegin(); it != A.rend(); ++it)<commit_msg>Minor bug fixes<commit_after>#pragma once

#include <string>
#include <iostream>
#include <iomanip>
#include "do_not_optimize.hpp"
#include "TimeHelpers.hpp"
#include "external/rang.hpp"

template <class Func>
double Benchmark(Func f, int numtimes = 1)
{
// 	f(); //warm up
	dscr::Chronometer C;
	for (int i = 0; i < numtimes; ++i)
	{
		f();
	}
	double avg = C.Reset()/numtimes;
	
	return avg;
}

template <class Container>
double FWIterationBenchmark(const Container& A)
{
	return Benchmark([&A]()
	{
		for (auto& a : A)
		{
			DoNotOptimize(a);
		}
	});
	
}

template <class Container>
double ReverseIterationBenchmark(const Container& A)
{
	return Benchmark([&A]()
	{
		for (auto it = A.rbegin(); it != A.rend(); ++it)
{'fraction_non_alphanumeric': 0.1638888888888889, 'fraction_numerical': 0.002777777777777778, 'mean_word_length': 4.278388278388278, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '7455604', 'n_tokens_mistral': 607, 'n_tokens_neox': 566, 'n_words': 143}