on master help sign in
switch TODO to PERF in many cases
029de76Evan Czaplicki
compiler/src/AST/Optimized.hs+1−1
@@ -135,7 +135,7 @@ data GlobalGraph =
135data LocalGraph =
135data LocalGraph =
136 LocalGraph
136 LocalGraph
137 { _l_main :: Maybe Main
137 { _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
139 , _l_fields :: Map.Map Name Int
139 , _l_fields :: Map.Map Name Int
140 }
140 }
141
141
compiler/src/Data/Utf8.hs+2−2
@@ -455,7 +455,7 @@ toEscapedBuilderHelp before after !name@(Utf8 ba#) k =
455 !bLen = minusPtr bEnd bOffset
455 !bLen = minusPtr bEnd bOffset
456 in
456 in
457 if len <= bLen then
457 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
459 copyToPtr name offset bOffset len
459 copyToPtr name offset bOffset len
460 escape before after bOffset name offset len 0
460 escape before after bOffset name offset len 0
461 let !newBufferRange = B.BufferRange (plusPtr bOffset len) bEnd
461 let !newBufferRange = B.BufferRange (plusPtr bOffset len) bEnd
@@ -565,7 +565,7 @@ data MBA s =
565 MBA# (MutableByteArray# s)
565 MBA# (MutableByteArray# s)
566
566
567
567
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
569newByteArray (I# len#) =
569newByteArray (I# len#) =
570 ST $ \s ->
570 ST $ \s ->
571 case newByteArray# len# s of
571 case newByteArray# len# s of
compiler/src/Elm/Compiler/Type/Extract.hs+1−1
@@ -87,7 +87,7 @@ toPublicName (ModuleName.Canonical _ home) name =
87
87
88newtype Types =
88newtype Types =
89 Types (Map.Map ModuleName.Canonical Types_)
89 Types (Map.Map ModuleName.Canonical Types_)
90− -- TODO profile Opt.Global representation
90+ -- PERF profile Opt.Global representation
91 -- current representation needs less allocation
91 -- current representation needs less allocation
92 -- but maybe the lookup is much worse
92 -- but maybe the lookup is much worse
93
93
compiler/src/Elm/Package.hs+1−1
@@ -279,7 +279,7 @@ instance Ord Name where
279-- BINARY
279-- BINARY
280
280
281
281
282−instance Binary Name where -- TODO try storing as a Word16
282+instance Binary Name where -- PERF try storing as a Word16
283 get = liftM2 Name Utf8.getUnder256 Utf8.getUnder256
283 get = liftM2 Name Utf8.getUnder256 Utf8.getUnder256
284 put (Name a b) = Utf8.putUnder256 a >> Utf8.putUnder256 b
284 put (Name a b) = Utf8.putUnder256 a >> Utf8.putUnder256 b
285
285
compiler/src/Json/String.hs+1−1
@@ -37,7 +37,7 @@ import qualified Parse.Primitives as P
37
37
38
38
39-- INVARIANT: any Json.String is appropriately escaped already
39-- 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?
41--
41--
42type String =
42type String =
43 Utf8.Utf8 JSON_STRING
43 Utf8.Utf8 JSON_STRING
compiler/src/Parse/Primitives.hs+2−2
@@ -46,7 +46,7 @@ newtype Parser x a =
46 )
46 )
47
47
48
48
49−data State = -- TODO try taking some out to avoid allocation?
49+data State = -- PERF try taking some out to avoid allocation
50 State
50 State
51 { _src :: ForeignPtr Word8
51 { _src :: ForeignPtr Word8
52 , _pos :: !(Ptr Word8)
52 , _pos :: !(Ptr Word8)
@@ -145,7 +145,7 @@ oneOfHelp state cok eok cerr eerr toError parsers =
145
145
146
146
147{-# INLINE oneOfWithFallback #-}
147{-# 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.
149oneOfWithFallback parsers fallback =
149oneOfWithFallback parsers fallback =
150 Parser $ \state cok eok cerr _ ->
150 Parser $ \state cok eok cerr _ ->
151 oowfHelp state cok eok cerr parsers fallback
151 oowfHelp state cok eok cerr parsers fallback
compiler/src/Parse/Variable.hs+1−1
@@ -67,7 +67,7 @@ lower toError =
67
67
68
68
69{-# NOINLINE reservedWords #-}
69{-# 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
71reservedWords =
71reservedWords =
72 Set.fromList
72 Set.fromList
73 [ "if", "then", "else"
73 [ "if", "then", "else"
compiler/src/Reporting/Annotation.hs+1−1
@@ -26,7 +26,7 @@ import Data.Word (Word16)
26
26
27
27
28data Located a =
28data Located a =
29− At Region a -- TODO see if unpacking region is helpful
29+ At Region a -- PERF see if unpacking region is helpful
30
30
31
31
32instance Functor Located where
32instance Functor Located where
compiler/src/Reporting/Result.hs+9−1
@@ -118,4 +118,12 @@ instance Monad (Result i w e) where
118 in
118 in
119 ka i w bad good1
119 ka i w bad good1
120
120
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
90
90
91
91
92instance Monad Unify where
92instance Monad Unify where
93− -- TODO PERF add INLINE here?
93+ -- PERF add INLINE here?
94 return a =
94 return a =
95 Unify $ \vars ok _ ->
95 Unify $ \vars ok _ ->
96 ok vars a
96 ok vars a
@@ -220,7 +220,7 @@ unifyFlex context content otherContent =
220 Error ->
220 Error ->
221 merge context Error
221 merge context Error
222
222
223− -- TODO see if wildcarding makes a noticable perf difference
223+ -- PERF see if wildcarding makes a noticable perf difference
224
224
225 FlexVar maybeName ->
225 FlexVar maybeName ->
226 merge context $
226 merge context $