haskoin/haskoin — pull request #74 by OttoAllmendinger (2014-07-16 07:53:58+00:00)
Title: Util: improve bsToHex performance

The old routine is very slow for larger inputs, something O(n^2):

```
> length $ bsToHex $ BS.pack $ take 3000 (repeat 0x62)
6000
(1.01 secs, 662956664 bytes)

> length $ bsToHex $ BS.pack $ take 6000 (repeat 0x62)
12000
(4.89 secs, 2993737936 bytes)
```

The new method is considerably faster:

```
> length $ bsToHex $ BS.pack $ take 6000000 (repeat 0x62)
12000000
(0.72 secs, 653576448 bytes)
```