bos/text — pull request #42 by tibbe (2013-02-25 02:09:56+00:00)
Title: Use unsafeDupablePerformIO instead of unsafePerformIO

(Depends on bos/text-test-data#1 for benchmark data).

`unsafePerformIO` adds a large overhead to e.g. `decodeUtf8'`, which is very noticeable for short strings.

Before:

```
benchmarking Pure/decode'/Text+tiny
mean: 324.7251 ns, lb 323.2915 ns, ub 326.5203 ns, ci 0.950
std dev: 8.188047 ns, lb 6.879514 ns, ub 10.15682 ns, ci 0.950
found 2 outliers among 100 samples (2.0%)
2 (2.0%) high mild
variance introduced by outliers: 19.017%
variance is moderately inflated by outliers

benchmarking Pure/decode'/LazyText+tiny
mean: 368.5147 ns, lb 366.5283 ns, ub 371.8252 ns, ci 0.950
std dev: 12.87182 ns, lb 9.000608 ns, ub 21.88841 ns, ci 0.950
found 4 outliers among 100 samples (4.0%)
2 (2.0%) high mild
2 (2.0%) high severe
variance introduced by outliers: 30.689%
variance is moderately inflated by outliers

benchmarking Pure/encode/Text+tiny
mean: 307.6835 ns, lb 306.4351 ns, ub 309.3087 ns, ci 0.950
std dev: 7.285172 ns, lb 6.002586 ns, ub 9.433231 ns, ci 0.950
found 3 outliers among 100 samples (3.0%)
3 (3.0%) high mild
variance introduced by outliers: 17.097%
variance is moderately inflated by outliers

benchmarking Pure/encode/LazyText+tiny
mean: 335.9881 ns, lb 334.7548 ns, ub 337.6909 ns, ci 0.950
std dev: 7.361941 ns, lb 5.815064 ns, ub 10.13922 ns, ci 0.950
found 6 outliers among 100 samples (6.0%)
5 (5.0%) high mild
1 (1.0%) high severe
variance introduced by outliers: 15.167%
variance is moderately inflated by outliers
```

After:

```
benchmarking Pure/decode'/Text+tiny
mean: 84.54321 ns, lb 84.01344 ns, ub 85.46088 ns, ci 0.950
std dev: 3.522873 ns, lb 2.317304 ns, ub 5.765366 ns, ci 0.950
found 4 outliers among 100 samples (4.0%)
3 (3.0%) high severe
variance introduced by outliers: 39.487%
variance is moderately inflated by outliers

benchmarking Pure/decode'/LazyText+tiny
mean: 119.1400 ns, lb 118.6129 ns, ub 119.8615 ns, ci 0.950
std dev: 3.129131 ns, lb 2.473641 ns, ub 4.167420 ns, ci 0.950
found 3 outliers among 100 samples (3.0%)
2 (2.0%) high severe
variance introduced by outliers: 20.001%
variance is moderately inflated by outliers

benchmarking Pure/encode/Text+tiny
mean: 56.10692 ns, lb 55.78816 ns, ub 56.69850 ns, ci 0.950
std dev: 2.160596 ns, lb 1.391698 ns, ub 3.988613 ns, ci 0.950
found 2 outliers among 100 samples (2.0%)
1 (1.0%) high severe
variance introduced by outliers: 35.558%
variance is moderately inflated by outliers

benchmarking Pure/encode/LazyText+tiny
mean: 73.50422 ns, lb 73.14254 ns, ub 74.02812 ns, ci 0.950
std dev: 2.204705 ns, lb 1.676123 ns, ub 3.223356 ns, ci 0.950
found 4 outliers among 100 samples (4.0%)
2 (2.0%) high mild
2 (2.0%) high severe
variance introduced by outliers: 24.826%
variance is moderately inflated by outliers
```