on master help sign in
switch TODO to PERF in many cases

so now there is a new category of PERF comments that are around to record ideas that may be useful if profiling ever shows hotspots in the general area

commit029de76642d823719c50bbecdb85a8d7fea30634 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 28 Jun 2019, 11:44 (7 years ago) parent7ac1c10
10 files changed+21−13
compiler/src/AST/Optimized.hs+1−1 compiler/src/Data/Utf8.hs+2−2 compiler/src/Elm/Compiler/Type/Extract.hs+1−1 compiler/src/Elm/Package.hs+1−1 compiler/src/Json/String.hs+1−1 compiler/src/Parse/Primitives.hs+2−2 compiler/src/Parse/Variable.hs+1−1 compiler/src/Reporting/Annotation.hs+1−1 compiler/src/Reporting/Result.hs+9−1 compiler/src/Type/Unify.hs+2−2
compiler/src/AST/Optimized.hs+1−1
@@ -135,7 +135,7 @@ data GlobalGraph =
135135data LocalGraph =
136136 LocalGraph
137137 { _l_main :: Maybe Main
138− , _l_nodes :: Map.Map Global Node -- TODO profile switching Global to Name
138+ , _l_nodes :: Map.Map Global Node -- PERF profile switching Global to Name
139139 , _l_fields :: Map.Map Name Int
140140 }
141141
compiler/src/Data/Utf8.hs+2−2
@@ -455,7 +455,7 @@ toEscapedBuilderHelp before after !name@(Utf8 ba#) k =
455455 !bLen = minusPtr bEnd bOffset
456456 in
457457 if len <= bLen then
458− do -- TODO test if writing word-by-word is faster
458+ do -- PERF test if writing word-by-word is faster
459459 copyToPtr name offset bOffset len
460460 escape before after bOffset name offset len 0
461461 let !newBufferRange = B.BufferRange (plusPtr bOffset len) bEnd
@@ -565,7 +565,7 @@ data MBA s =
565565 MBA# (MutableByteArray# s)
566566
567567
568−newByteArray :: Int -> ST s (MBA s) -- TODO see if newPinnedByteArray for len > 256 is positive
568+newByteArray :: Int -> ST s (MBA s) -- PERF see if newPinnedByteArray for len > 256 is positive
569569newByteArray (I# len#) =
570570 ST $ \s ->
571571 case newByteArray# len# s of
compiler/src/Elm/Compiler/Type/Extract.hs+1−1
@@ -87,7 +87,7 @@ toPublicName (ModuleName.Canonical _ home) name =
8787
8888newtype Types =
8989 Types (Map.Map ModuleName.Canonical Types_)
90− -- TODO profile Opt.Global representation
90+ -- PERF profile Opt.Global representation
9191 -- current representation needs less allocation
9292 -- but maybe the lookup is much worse
9393
compiler/src/Elm/Package.hs+1−1
@@ -279,7 +279,7 @@ instance Ord Name where
279279-- BINARY
280280
281281
282−instance Binary Name where -- TODO try storing as a Word16
282+instance Binary Name where -- PERF try storing as a Word16
283283 get = liftM2 Name Utf8.getUnder256 Utf8.getUnder256
284284 put (Name a b) = Utf8.putUnder256 a >> Utf8.putUnder256 b
285285
compiler/src/Json/String.hs+1−1
@@ -37,7 +37,7 @@ import qualified Parse.Primitives as P
3737
3838
3939-- INVARIANT: any Json.String is appropriately escaped already
40−-- TODO: is this the right representation for Json.String? Maybe ByteString instead?
40+-- PERF: is this the right representation for Json.String? Maybe ByteString instead?
4141--
4242type String =
4343 Utf8.Utf8 JSON_STRING
compiler/src/Parse/Primitives.hs+2−2
@@ -46,7 +46,7 @@ newtype Parser x a =
4646 )
4747
4848
49−data State = -- TODO try taking some out to avoid allocation?
49+data State = -- PERF try taking some out to avoid allocation
5050 State
5151 { _src :: ForeignPtr Word8
5252 , _pos :: !(Ptr Word8)
@@ -145,7 +145,7 @@ oneOfHelp state cok eok cerr eerr toError parsers =
145145
146146
147147{-# INLINE oneOfWithFallback #-}
148−oneOfWithFallback :: [Parser x a] -> a -> Parser x a -- TODO is this function okay? Worried about allocation/laziness with fallback values.
148+oneOfWithFallback :: [Parser x a] -> a -> Parser x a -- PERF is this function okay? Worried about allocation/laziness with fallback values.
149149oneOfWithFallback parsers fallback =
150150 Parser $ \state cok eok cerr _ ->
151151 oowfHelp state cok eok cerr parsers fallback
compiler/src/Parse/Variable.hs+1−1
@@ -67,7 +67,7 @@ lower toError =
6767
6868
6969{-# NOINLINE reservedWords #-}
70−reservedWords :: Set.Set Name.Name -- TODO try using a trie instead
70+reservedWords :: Set.Set Name.Name -- PERF try using a trie instead
7171reservedWords =
7272 Set.fromList
7373 [ "if", "then", "else"
compiler/src/Reporting/Annotation.hs+1−1
@@ -26,7 +26,7 @@ import Data.Word (Word16)
2626
2727
2828data Located a =
29− At Region a -- TODO see if unpacking region is helpful
29+ At Region a -- PERF see if unpacking region is helpful
3030
3131
3232instance Functor Located where
compiler/src/Reporting/Result.hs+9−1
@@ -118,4 +118,12 @@ instance Monad (Result i w e) where
118118 in
119119 ka i w bad good1
120120
121− -- TODO PERF add more specialized definitions?
121+ (>>) (Result ka) (Result kb) =
122+ Result $ \i w bad good ->
123+ let
124+ good1 i1 w1 _ =
125+ kb i1 w1 bad good
126+ in
127+ ka i w bad good1
128+
129+ -- PERF add INLINE to these?
compiler/src/Type/Unify.hs+2−2
@@ -90,7 +90,7 @@ instance Applicative Unify where
9090
9191
9292instance Monad Unify where
93− -- TODO PERF add INLINE here?
93+ -- PERF add INLINE here?
9494 return a =
9595 Unify $ \vars ok _ ->
9696 ok vars a
@@ -220,7 +220,7 @@ unifyFlex context content otherContent =
220220 Error ->
221221 merge context Error
222222
223− -- TODO see if wildcarding makes a noticable perf difference
223+ -- PERF see if wildcarding makes a noticable perf difference
224224
225225 FlexVar maybeName ->
226226 merge context $