Permalink
Browse files

Add INLINE pragma for hexEscape

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 1a2f79a1d9eb0c706f60acb9f3c38fd550cf9ee9
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/Data/Json/Builder.hs
View
@@ -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
@@ -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

0 comments on commit 1a2f79a

Please sign in to comment.