View difference between Paste ID: de8xA3n5 and 62b3YK4s
SHOW: | | - or go back to the newest paste.
1-
-- from http://stackoverflow.com/questions/10080273/how-to-get-good-performance-when-writing-a-list-of-integers-from-1-to-10-million
1+
2
import qualified Data.ByteString as S
3
import qualified Data.ByteString.Lazy as L
4-
import Data.Text.Lazy.IO as Text
4+
import Blaze.ByteString.Builder
5-
import Data.Text.Lazy.Builder as Text
5+
import Blaze.ByteString.Builder.Char.Utf8
6-
import Data.Text.Lazy.Builder.Int as Text
6+
7
8
decimals = V.generate 10000000 (\i -> fromShow $ i + 1)
9-
decimals = V.generate 10000000 (\i -> Text.decimal $ i + 1)
9+
with_newlines = V.map (`mappend` fromChar '\n') decimals
10-
with_newlines = V.map (`mappend` Text.singleton '\n') decimals
10+
11
main = L.putStr . toLazyByteString $ concatd