make catObjectStream support newline and carriage return in filenames

Turns out the %(rest) trick was not needed. Instead, just maintain a
list of files we've asked for, and each cat-file response is for the
next file in the list.

This actually benchmarks 25% faster than before! Very surprising, but it
must be due to needing to shove less data through the pipe, and parse
less.
This commit is contained in:
Joey Hess 2020-07-08 12:34:56 -04:00
parent 2cf6717aec
commit de3d7d044d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 34 additions and 37 deletions

View file

@ -6,7 +6,9 @@
- Unlike a TQueue, the entire contents of a TList can be efficiently
- read without modifying it.
-
- Copyright 2013 Joey Hess <id@joeyh.name>
- Copyright 2013-2020 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
{-# LANGUAGE BangPatterns #-}
@ -21,6 +23,7 @@ module Utility.TList (
consTList,
snocTList,
appendTList,
headTList,
) where
import Common
@ -77,3 +80,6 @@ snocTList tlist v = modifyTList tlist $ \dl -> D.snoc dl v
appendTList :: TList a -> [a] -> STM ()
appendTList tlist l = modifyTList tlist $ \dl -> D.append dl (D.fromList l)
headTList :: TList a -> STM a
headTList tlist = D.head <$> readTMVar tlist