@@ -172,6 +172,11 @@ shiftAdd conv xs =
172 map (\(j, x) -> shiftL x (j * 8)) $ zip [0 ..] $ map conv xs
172 map (\(j, x) -> shiftL x (j * 8)) $ zip [0 ..] $ map conv xs
174-- Note: This only works in little endian machines
174-- Note: This only works in little endian machines
176+-- Instead of generating this via TH can't we write it directly in Haskell and
177+-- use that? Creating one comparison function for each deserialization may be
178+-- too much code and may not be necessary.
179+-- Benchmark both the implementations and check.
175xorCmp :: [Word8] -> Name -> Name -> Q Exp
180xorCmp :: [Word8] -> Name -> Name -> Q Exp
176xorCmp tag off arr =
181xorCmp tag off arr =
177 case tagLen of
182 case tagLen of
@@ -253,7 +258,10 @@ xorCmp tag off arr =
253-- Primitive serialization
258-- Primitive serialization
254--------------------------------------------------------------------------------
259--------------------------------------------------------------------------------
256−-- XXX Batch serialize? See xorCmp
261+-- TODO:
262+-- Will this be too much of a code bloat?
263+-- Loop with the loop body unrolled?
264+-- Serialize this in batches similar to batch comparision in xorCmp?
257serializeW8List :: Name -> Name -> [Word8] -> Q Exp
265serializeW8List :: Name -> Name -> [Word8] -> Q Exp
258serializeW8List off arr w8List = do
266serializeW8List off arr w8List = do
259 [|let $(varP (makeN 0)) = $(varE off)
267 [|let $(varP (makeN 0)) = $(varE off)