Permalink
Browse files

Tiny perf tweaks

  • Loading branch information...
bos committed Dec 23, 2011
1 parent 24ede99 commit 991b32d2bc388ecedcaaf08faf37a4cfd5197c57
Showing with 2 additions and 2 deletions.
  1. +2 −2 Data/Aeson/Encode.hs
View
@@ -1,4 +1,4 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BangPatterns, OverloadedStrings #-}
-- |
-- Module: Data.Aeson.Encode
@@ -63,7 +63,7 @@ string s = {-# SCC "string" #-} singleton '"' <> quote s <> singleton '"'
where
quote q = case T.uncons t of
Nothing -> fromText h
- Just (c,t') -> fromText h <> escape c <> quote t'
+ Just (!c,t') -> fromText h <> escape c <> quote t'
where (h,t) = {-# SCC "break" #-} T.break isEscape q
isEscape c = c == '\"' || c == '\\' || c < '\x20'
escape '\"' = "\\\""

0 comments on commit 991b32d

Please sign in to comment.