use attoparsec parser for String parsing, 10x speedup
This is not as efficient as using ByteStrings throughout, but converting the String to ByteString is actually significantly faster than the old parser. benchmarking parse/old time 9.657 μs (9.600 μs .. 9.732 μs) 1.000 R² (0.999 R² .. 1.000 R²) mean 9.703 μs (9.645 μs .. 9.785 μs) std dev 231.6 ns (161.5 ns .. 323.7 ns) variance introduced by outliers: 25% (moderately inflated) benchmarking parse/new time 834.6 ns (797.1 ns .. 886.9 ns) 0.987 R² (0.976 R² .. 0.999 R²) mean 816.4 ns (802.7 ns .. 845.1 ns) std dev 62.39 ns (37.66 ns .. 108.4 ns) variance introduced by outliers: 82% (severely inflated) There is a small behavior change from the old parsePOSIXTime, which accepted any amount of trailing whitespace after the timestamp. That behavior was not documented, and it doesn't seem anything relied on it.
This commit is contained in:
parent
3c74dcd4e1
commit
3ba6e9bb96
3 changed files with 6 additions and 20 deletions
|
@ -156,7 +156,7 @@ readInodeCache s = case words s of
|
|||
(inode:size:mtime:mtimedecimal:_) -> do
|
||||
i <- readish inode
|
||||
sz <- readish size
|
||||
t <- parsePOSIXTime' mtime mtimedecimal
|
||||
t <- parsePOSIXTime $ mtime ++ '.' : mtimedecimal
|
||||
return $ InodeCache $ InodeCachePrim i sz (MTimeHighRes t)
|
||||
_ -> Nothing
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue