<commit_before>ghc-prof-flags :=
ifdef ENABLE_PROFILING
	ghc-prof-flags += -prof -hisuf p_hi -osuf p_o
	lib-suffix := _p
else
	lib-suffix :=
endif

ghc := ghc
extra-ghc-flags :=

package := unordered-containers
version := $(shell awk '/^version:/{print $$2}' ../$(package).cabal)
lib := ../dist/build/libHS$(package)-$(version)$(lib-suffix).a
ghc-flags := -Wall -O2 -hide-all-packages \
	-package-conf ../dist/package.conf.inplace -package base -package mtl \
	-package unordered-containers -package containers -package criterion \
	-package deepseq -package hashable -package random -package bytestring \
	$(ghc-prof-flags) -rtsopts
ghc-flags += $(extra-ghc-flags)

%.o: %.hs
	$(ghc) $(ghc-flags) -c -o $@ $<

programs := bench

.PHONY: all
all: $(programs)

bench: $(lib) Benchmarks.o Util/Int.o Util/ByteString.o Util/String.o
	ranlib $(lib)
	$(ghc) $(ghc-flags) -threaded -o $@ $(filter %.o,$^) $(lib)

.PHONY: clean
clean:
	-find . \( -name '*.o' -o -name '*.hi' \) -exec rm {} \;
	-rm -f $(programs)
<commit_msg>Backport: Make it easy to produce a CSV report with benchmark results<commit_after>ghc-prof-flags :=
ifdef ENABLE_PROFILING
	ghc-prof-flags += -prof -hisuf p_hi -osuf p_o
	lib-suffix := _p
else
	lib-suffix :=
endif

ghc := ghc
extra-ghc-flags :=

package := unordered-containers
version := $(shell awk '/^version:/{print $$2}' ../$(package).cabal)
lib := ../dist/build/libHS$(package)-$(version)$(lib-suffix).a
ghc-flags := -Wall -O2 -hide-all-packages \
	-package-conf ../dist/package.conf.inplace -package base -package mtl \
	-package unordered-containers -package containers -package criterion \
	-package deepseq -package hashable -package random -package bytestring \
	$(ghc-prof-flags) -rtsopts
ghc-flags += $(extra-ghc-flags)
criterion-flags :=

%.o: %.hs
	$(ghc) $(ghc-flags) -c -o $@ $<

programs := bench

.PHONY: all
all: $(programs)

bench: $(lib) Benchmarks.o Util/Int.o Util/ByteString.o Util/String.o
	ranlib $(lib)
	$(ghc) $(ghc-flags) -threaded -o $@ $(filter %.o,$^) $(lib)

.PHONY: bench-all
bench-all: bench
	./bench -l | grep -v "Benchmarks:\|IntMap\|Map" | tr '\n' ' ' | xargs -d ' ' ./bench $(criterion-flags) +RTS -H -RTS

.PHONY: clean
clean:
	-find . \( -name '*.o' -o -name '*.hi' \) -exec rm {} \;
	-rm -f $(programs)

{'fraction_non_alphanumeric': 0.19955849889624724, 'fraction_numerical': 0.0017660044150110375, 'mean_word_length': 3.3745173745173744, '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': '69049', 'n_tokens_mistral': 902, 'n_tokens_neox': 876, 'n_words': 222}