on master help sign in
Add TODO comments in Serialize.TH
commitc36f8bb86137fa6d59a19c3cef7a4000ecaa0b1d authorAdithya Kumar <adithya@composewell.com> dateSat 9 Sep 2023, 21:18 (3 years ago) parent7e297dd
1 file changed+9−1
core/src/Streamly/Internal/Data/Serialize/TH.hs+9−1
core/src/Streamly/Internal/Data/Serialize/TH.hs+9−1
@@ -172,6 +172,11 @@ shiftAdd conv xs =
172172 map (\(j, x) -> shiftL x (j * 8)) $ zip [0 ..] $ map conv xs
173173
174174-- Note: This only works in little endian machines
175+-- TODO:
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.
175180xorCmp :: [Word8] -> Name -> Name -> Q Exp
176181xorCmp tag off arr =
177182 case tagLen of
@@ -253,7 +258,10 @@ xorCmp tag off arr =
253258-- Primitive serialization
254259--------------------------------------------------------------------------------
255260
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?
257265serializeW8List :: Name -> Name -> [Word8] -> Q Exp
258266serializeW8List off arr w8List = do
259267 [|let $(varP (makeN 0)) = $(varE off)