<commit_before>package main

import (
	"fmt"
	"runtime"
	"time"

	"github.com/smartystreets/go-disruptor"
)

const (
	BufferSize = 1024 * 64
	BufferMask = BufferSize - 1
	Iterations = 1000000 * 100
)

var ringBuffer = [BufferSize]int64{}

func main() {
	runtime.GOMAXPROCS(2)

	written, read := disruptor.NewCursor(), disruptor.NewCursor()
	reader := disruptor.NewReader(read, written, written, SampleConsumer{})

	started := time.Now()
	reader.Start()
	publish(written, read)
	// publish(disruptor.NewWriter(written, read, BufferSize))
	reader.Stop()
	finished := time.Now()
	fmt.Println(Iterations, finished.Sub(started))
}

// func publish(writer *disruptor.Writer) {
// 	for sequence := disruptor.InitialSequenceValue; sequence <= Iterations; {
// 		sequence = writer.Reserve()
// 		ringBuffer[sequence&BufferMask] = sequence
// 		writer.Commit(sequence)
// 	}
// }<commit_msg>Inlined variable.<commit_after>package main

import (
	"fmt"
	"runtime"
	"time"

	"github.com/smartystreets/go-disruptor"
)

const (
	BufferSize = 1024 * 64
	BufferMask = BufferSize - 1
	Iterations = 1000000 * 100
)

var ringBuffer = [BufferSize]int64{}

func main() {
	runtime.GOMAXPROCS(2)

	written, read := disruptor.NewCursor(), disruptor.NewCursor()
	reader := disruptor.NewReader(read, written, written, SampleConsumer{})

	started := time.Now()
	reader.Start()
	publish(written, read)
	reader.Stop()
	finished := time.Now()
	fmt.Println(Iterations, finished.Sub(started))
}

// func publish(written *disruptor.Cursor, upstream disruptor.Barrier) {
// 	writer := disruptor.NewWriter(written, upstream, BufferSize)
// 	for sequence := disruptor.InitialSequenceValue; sequence <= Iterations; {
// 		sequence = writer.Reserve()
// 		ringBuffer[sequence&BufferMask] = sequence
// 		writer.Commit(sequence)
// 	}
// }
{'fraction_non_alphanumeric': 0.14833333333333334, 'fraction_numerical': 0.022222222222222223, 'mean_word_length': 4.524539877300613, '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': '57737', 'n_tokens_mistral': 660, 'n_tokens_neox': 609, 'n_words': 120}