text
text copied to clipboard
Feature: `sconcat` and `stimes`.
Resolve #288.
There are two commits here.
- Commit № 1 adds two new benchmarks in the
Pure
section: one forsconcat
and one forstimes
. - Commit № 2 adds specialized implementation of
sconcat
andstimes
to the instance ofSemigroup
for strictText
.
The benchmarks can be run like so:
first_commit_hash='180645e'
pattern='$2 == "Pure" && ($4 == "sconcat" || $4 == "stimes") && $5 != "LazyText"'
git checkout "$first_commit_hash" &&
cabal run text-benchmarks -- --pattern "$pattern" --timeout 10s --csv benchmarks.csv
git switch feature-sconcat-stimes &&
cabal run text-benchmarks -- --pattern "$pattern" --timeout 10s --baseline benchmarks.csv --fail-if-slower 110
This will take a few minutes. You should see better times almost everywhere — only the tiny.sconcat
will show worse times.
This is the report as seen on my machine:
All
Pure
tiny
sconcat
Text: FAIL
38.6 ns ± 2.3 ns, 148% more than baseline
Use -p '(($2=="Pure"&&($4=="sconcat"||$4=="stimes"))&&$5!="LazyText")&&/tiny.sconcat.Text/' to rerun this test only.
stimes
Text: OK
70.7 ns ± 2.9 ns, 83% less than baseline
ascii-small
sconcat
Text: OK
18.6 μs ± 148 ns, 99% less than baseline
stimes
Text: OK
125 μs ± 10 μs, 59% less than baseline
ascii
sconcat
Text: OK
28.7 ms ± 2.4 ms
stimes
Text: OK
63.3 ms ± 5.6 ms, 78% less than baseline
english
sconcat
Text: OK
1.07 ms ± 7.4 μs
stimes
Text: OK
4.40 ms ± 373 μs, 69% less than baseline
russian
sconcat
Text: OK
2.45 μs ± 224 ns, 95% less than baseline
stimes
Text: OK
15.9 μs ± 736 ns, 62% less than baseline
japanese
sconcat
Text: OK
4.17 μs ± 175 ns, 97% less than baseline
stimes
Text: OK
15.7 μs ± 1.4 μs, 63% less than baseline