<commit_before>package align

import (
	"os"
	"strings"
	"testing"
)

func BenchmarkColumnCounts(b *testing.B) {
	input := `First,Middle,Last,Email,Region,City,Zip,Full_Name,First,Middle,Last,Email,Region,City,Zip,Full_Name,First,Middle,Last,Email,Region,City,Zip,Full_Name
Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>        
Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez         
Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>illy        
Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,<NAME> ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez         
Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>        
Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez         
`

	sw := NewAligner(strings.NewReader(input), os.Stdout, ',')

	b.ReportAllocs()
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		_ = sw.ColumnCounts()
	}
}<commit_msg>add benchmarks for custom Split (#25)<commit_after>package align

import (
	"os"
	"strings"
	"testing"
)

func BenchmarkColumnCounts(b *testing.B) {
	input := `First,Middle,Last,Email,Region,City,Zip,Full_Name,First,Middle,Last,Email,Region,City,Zip,Full_Name,First,Middle,Last,Email,Region,City,Zip,Full_Name
Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>illy        
Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,O<NAME> ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,<NAME> ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Oli<NAME>elez         
Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>        
Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,<NAME> ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,Olivia Velez ,Alisa,Walker,Armand,<EMAIL>,Himachal Pradesh,Shimla,MZ0 4QS,O<NAME>         
Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>,Karleigh,Destiny,Dean,<EMAIL>,Stockholms län,Märsta,9038,<NAME>        
Alisa,Walker,Armand,<EMAIL>,<NAME>,Shimla,MZ0 4QS,<NAME> ,Alisa,Walker,Armand,<EMAIL>,<NAME>,Shimla,MZ0 4QS,<NAME> ,Alisa,Walker,Armand,<EMAIL>,<NAME>,Shimla,MZ0 4QS,<NAME>         
`

	sw := NewAligner(strings.NewReader(input), os.Stdout, ',', TextQualifier{On: false})

	b.ReportAllocs()
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		_ = sw.ColumnCounts()
	}
}

func BenchmarkSplitWithQual(b *testing.B) {
	input := "First,\"Middle, name\",Last,Email,Region,City,Zip,Full_Name"

	sw := NewAligner(strings.NewReader(input), os.Stdout, ',', TextQualifier{On: true, Qualifier: '"'})

	b.ReportAllocs()
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		_ = sw.SplitWithQual(input, ",", "\"")
	}
}

func BenchmarkSplitWithQualNoQual(b *testing.B) {
	input := "First,Middle,Last,Email,Region,City,Zip,Full_Name"

	sw := NewAligner(strings.NewReader(input), os.Stdout, ',', TextQualifier{On: false})

	b.ReportAllocs()
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		_ = sw.SplitWithQual(input, ",", "\"")
	}
}
{'fraction_non_alphanumeric': 0.1726248775710088, 'fraction_numerical': 0.02791380999020568, 'mean_word_length': 8.703087885985749, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 69, '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': '6300706', 'n_tokens_mistral': 1966, 'n_tokens_neox': 1760, 'n_words': 177}