on develop help sign in
Improve inlining of cacheEvent, fanInt, and mergeIntIncremental
7c62738Ryan Trinkle
src/Reflex/Spider/Internal.hs+3−1
@@ -266,7 +266,7 @@ data CacheSubscribed x a
266--TODO: Try a caching strategy where we subscribe directly to the parent when
266--TODO: Try a caching strategy where we subscribe directly to the parent when
267--there's only one subscriber, and then build our own FastWeakBag only when a second
267--there's only one subscriber, and then build our own FastWeakBag only when a second
268--subscriber joins
268--subscriber joins
269−{-# NOINLINE cacheEvent #-}
269+{-# NOINLINE [0] cacheEvent #-}
270cacheEvent :: forall x a. HasSpiderTimeline x => Event x a -> Event x a
270cacheEvent :: forall x a. HasSpiderTimeline x => Event x a -> Event x a
271cacheEvent e =
271cacheEvent e =
272#ifdef DEBUG_TRACE_EVENTS
272#ifdef DEBUG_TRACE_EVENTS
@@ -2330,7 +2330,9 @@ instance HasSpiderTimeline x => R.Reflex (SpiderTimeline x) where
2330 eventCoercion Coercion = Coercion
2330 eventCoercion Coercion = Coercion
2331 behaviorCoercion Coercion = Coercion
2331 behaviorCoercion Coercion = Coercion
2332 dynamicCoercion = unsafeCoerce --TODO: How can we avoid this unsafeCoerce? This is safe only because we know how Identity works as a Patch instance
2332 dynamicCoercion = unsafeCoerce --TODO: How can we avoid this unsafeCoerce? This is safe only because we know how Identity works as a Patch instance
2333+ {-# INLINABLE mergeIntIncremental #-}
2333 mergeIntIncremental = SpiderEvent . mergeInt . (unsafeCoerce :: Dynamic x (PatchIntMap (R.Event (SpiderTimeline x) a)) -> Dynamic x (PatchIntMap (Event x a))) . unSpiderIncremental
2334 mergeIntIncremental = SpiderEvent . mergeInt . (unsafeCoerce :: Dynamic x (PatchIntMap (R.Event (SpiderTimeline x) a)) -> Dynamic x (PatchIntMap (Event x a))) . unSpiderIncremental
2335+ {-# INLINABLE fanInt #-}
2334 fanInt e = R.EventSelectorInt $ SpiderEvent . selectInt (fanInt (unSpiderEvent e))
2336 fanInt e = R.EventSelectorInt $ SpiderEvent . selectInt (fanInt (unSpiderEvent e))
2335#endif
2337#endif
2336
2338