<commit_before>package fileseq

import (
	"fmt"
	"testing"
)

func benchFrameSetCreate(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	_, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	for i := 0; i < b.N; i++ {
		NewFrameSet(r)
	}
}

func benchFrameSetValue(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	fs, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	idx := fs.Len() - 1
	for i := 0; i < b.N; i++ {
		fs.Frame(idx)
	}
}

func benchFrameSetIndex(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	fs, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	val, err := fs.Frame(fs.Len() - 1)
	if err != nil {
		b.Fatal(err.Error())
	}
	for i := 0; i < b.N; i++ {
		fs.Index(val)
	}
}

func benchFrameSetContains(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	fs, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	start := fs.Start()
	end := fs.End()
	mid := end / 2
	for i := 0; i < b.N; i++ {
		fs.HasFrame(start)<commit_msg>Fix benchmarks by resetting timer appropriately<commit_after>package fileseq

import (
	"fmt"
	"testing"
)

func benchFrameSetCreate(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	_, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		NewFrameSet(r)
	}
}

func benchFrameSetValue(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	fs, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	idx := fs.Len() - 1

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		fs.Frame(idx)
	}
}

func benchFrameSetIndex(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	fs, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	val, err := fs.Frame(fs.Len() - 1)
	if err != nil {
		b.Fatal(err.Error())
	}

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		fs.Index(val)
	}
}

func benchFrameSetContains(b *testing.B, n int) {
	r := fmt.Sprintf("1-%dx2", n)
	fs, err := NewFrameSet(r)
	if err != nil {
		b.Fatal(err.Error())
	}
	start := fs.Start()
	end := fs.End()
	mid := end / 2

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		fs.HasFrame(start)
{'fraction_non_alphanumeric': 0.21488372093023256, 'fraction_numerical': 0.013953488372093023, 'mean_word_length': 2.9833333333333334, 'pattern_counts': {'":': 0, '<': 11, '<?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': '1915819', 'n_tokens_mistral': 1023, 'n_tokens_neox': 969, 'n_words': 228}