<commit_before>package storebench

import (
	"io/ioutil"
	"log"
	"strconv"
	"testing"

	"github.com/skyec/astore"
	blobs "github.com/skyec/astore/testing"
)

var benchStore astore.WriteableStore
var benchDir string

func init() {
}
func BenchmarkDefaultWrite(b *testing.B) {
	benchDir, err := ioutil.TempDir("", "astore-benchmarking-")
	if err != nil {
		log.Fatal(err)
	}

	benchStore, err := astore.NewReadWriteableStore(benchDir)
	if err != nil {
		log.Fatal(err)

	}

	err = benchStore.Initialize()
	if err != nil {
		log.Fatal("Failed to initialze the store:", err)
	}

	log.Print("############\nBe sure to 'rm -rf %s'", benchDir)
	blobs := blobs.GenerateBlobs(b.N)
	b.ResetTimer()
	for i := 0; i < len(blobs); i++ {
		err := benchStore.WriteToKey(strconv.Itoa(i%10), blobs[i])
		if err != nil {
			b.Fatal("Failed to write to store:", err)
		}
	}
}<commit_msg>Automatically clean up after the benchmark tests<commit_after>package storebench

import (
	"io/ioutil"
	"log"
	"os"
	"strconv"
	"testing"

	"github.com/skyec/astore"
	blobs "github.com/skyec/astore/testing"
)

var benchStore astore.WriteableStore
var benchDir string

func init() {
}
func BenchmarkDefaultWrite(b *testing.B) {
	benchDir, err := ioutil.TempDir("", "astore-benchmarking-")
	if err != nil {
		log.Fatal(err)
	}

	benchStore, err := astore.NewReadWriteableStore(benchDir)
	if err != nil {
		log.Fatal(err)

	}

	err = benchStore.Initialize()
	if err != nil {
		log.Fatal("Failed to initialze the store:", err)
	}

	blobs := blobs.GenerateBlobs(b.N)
	b.ResetTimer()
	for i := 0; i < len(blobs); i++ {
		err := benchStore.WriteToKey(strconv.Itoa(i%10), blobs[i])
		if err != nil {
			b.Fatal("Failed to write to store:", err)
		}
	}
	b.StopTimer()
	os.RemoveAll(benchDir)

}
{'fraction_non_alphanumeric': 0.16267123287671234, 'fraction_numerical': 0.003424657534246575, 'mean_word_length': 4.051873198847262, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2993201', 'n_tokens_mistral': 733, 'n_tokens_neox': 693, 'n_words': 152}