Fix the benchmarks

This commit is contained in:
mrkkrp 2019-09-25 19:53:54 +02:00 committed by Mark Karpov
parent 7442858124
commit acf0c08cd8
2 changed files with 18 additions and 20 deletions

View File

@ -120,16 +120,15 @@ breachOffset o0 o1 = func
f
(o0 * 80, o1 * 80)
where
f :: (Int, Int) -> (SourcePos, PosState Text)
f :: (Int, Int) -> PosState Text
f (startOffset, targetOffset) =
let (x, _, y) = reachOffset targetOffset PosState
{ pstateInput = manyAs (targetOffset - startOffset)
, pstateOffset = startOffset
, pstateSourcePos = initialPos ""
, pstateTabWidth = defaultTabWidth
, pstateLinePrefix = ""
}
in (x, y)
snd $ reachOffset targetOffset PosState
{ pstateInput = manyAs (targetOffset - startOffset)
, pstateOffset = startOffset
, pstateSourcePos = initialPos ""
, pstateTabWidth = defaultTabWidth
, pstateLinePrefix = ""
}
-- | Bench the 'reachOffsetNoLine' function.
@ -142,7 +141,7 @@ breachOffsetNoLine o0 o1 = func
f
(o0 * 80, o1 * 80)
where
f :: (Int, Int) -> (SourcePos, PosState Text)
f :: (Int, Int) -> PosState Text
f (startOffset, targetOffset) =
reachOffsetNoLine targetOffset PosState
{ pstateInput = manyAs (targetOffset - startOffset)

View File

@ -117,16 +117,15 @@ breachOffset o0 o1 = bench
("reachOffset-" ++ show o0 ++ "-" ++ show o1)
(nf f (o0 * 80, o1 * 80))
where
f :: (Int, Int) -> (SourcePos, PosState Text)
f :: (Int, Int) -> PosState Text
f (startOffset, targetOffset) =
let (x, _, y) = reachOffset targetOffset PosState
{ pstateInput = manyAs (targetOffset - startOffset)
, pstateOffset = startOffset
, pstateSourcePos = initialPos ""
, pstateTabWidth = defaultTabWidth
, pstateLinePrefix = ""
}
in (x, y)
snd $ reachOffset targetOffset PosState
{ pstateInput = manyAs (targetOffset - startOffset)
, pstateOffset = startOffset
, pstateSourcePos = initialPos ""
, pstateTabWidth = defaultTabWidth
, pstateLinePrefix = ""
}
-- | Bench the 'reachOffsetNoLine' function.
@ -138,7 +137,7 @@ breachOffsetNoLine o0 o1 = bench
("reachOffsetNoLine-" ++ show o0 ++ "-" ++ show o1)
(nf f (o0 * 80, o1 * 80))
where
f :: (Int, Int) -> (SourcePos, PosState Text)
f :: (Int, Int) -> PosState Text
f (startOffset, targetOffset) =
reachOffsetNoLine targetOffset PosState
{ pstateInput = manyAs (targetOffset - startOffset)