Skip to content

Commit

Permalink
Add INLINE pragma for hexEscape
Browse files Browse the repository at this point in the history
This is a small, but seemingly clear win.  Interestingly, adding
a INLINE pragma quoteChar appears to be performance hit.
  • Loading branch information
lpsmith committed Jul 2, 2011
1 parent a233dc2 commit 1a2f79a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Data/Json/Builder.hs
Expand Up @@ -66,7 +66,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.UTF8 as BU
import qualified Data.ByteString.Lazy.UTF8 as BLU
import Data.ByteString.Internal ( c2w )
import Data.ByteString.Internal ( c2w,w2c )

import qualified Data.Text as T
import qualified Data.Text.Lazy as TL
Expand Down Expand Up @@ -279,6 +279,7 @@ hexEscape (c2w -> c)
= writeByteString "\\u00"
++ writeWord8 (char ((c `shiftR` 4) .&. 0xF))
++ writeWord8 (char ( c .&. 0xF))
{-# INLINE hexEscape #-}

char :: Word8 -> Word8
char i | i < 10 = i + 48
Expand Down

0 comments on commit 1a2f79a

Please sign in to comment.