summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf/should_run/InlineByteArrayAlloc.hs
blob: fa4883fa58749fa2dc55d7f803b7e5cf1b8312ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Main where

import GHC.Exts
import GHC.IO

main :: IO ()
main = loop 10000000
  where
    loop :: Int -> IO ()
    loop 0 = return ()
    loop i = newByteArray >> loop (i-1)

newByteArray :: IO ()
newByteArray = IO $ \s -> case newByteArray# 128# s of
    (# s', _ #) -> (# s', () #)