@@ -84,9 +84,9 @@ import Data.Zip (Zip (..))
85#ifdef DEBUG_CYCLES
85#ifdef DEBUG_CYCLES
86import Control.Monad.State hiding (forM, forM_, mapM, mapM_, sequence)
86import Control.Monad.State hiding (forM, forM_, mapM, mapM_, sequence)
87−import Data.List.NonEmpty (NonEmpty (..), nonEmpty)
89+import Data.List.NonEmpty (NonEmpty (..), nonEmpty)
90import qualified Data.List.NonEmpty as NonEmpty
90import qualified Data.List.NonEmpty as NonEmpty
91import Data.Tree (Forest, Tree (..), drawForest)
91import Data.Tree (Forest, Tree (..), drawForest)
92import Data.List (isPrefixOf)
92import Data.List (isPrefixOf)
@@ -166,6 +166,10 @@ showNodeId' = ("#"<>) . show
166showNodeId :: a -> String
166showNodeId :: a -> String
167showNodeId _ = ""
167showNodeId _ = ""
169+{-# INLINE showNodeId' #-}
170+showNodeId' :: Int -> String
171#ifdef DEBUG_NODEIDS
175#ifdef DEBUG_NODEIDS
@@ -298,39 +302,18 @@ cacheEvent e =
299 subscribers <- liftIO FastWeakBag.empty
303 subscribers <- liftIO FastWeakBag.empty
300 occRef <- liftIO $ newIORef Nothing -- This should never be read prior to being set below
304 occRef <- liftIO $ newIORef Nothing -- This should never be read prior to being set below
301−<<<<<<< HEAD
305+#ifdef DEBUG_NODEIDS
302 (parentSub, occ) <- subscribeAndRead e $ debugSubscriber' ("cacheEvent" <> showNodeId' nodeId) $ Subscriber
306 (parentSub, occ) <- subscribeAndRead e $ debugSubscriber' ("cacheEvent" <> showNodeId' nodeId) $ Subscriber
308+ (parentSub, occ) <- subscribeAndRead e $ Subscriber
303 { subscriberPropagate = \a -> do
310 { subscriberPropagate = \a -> do
304− -- checkCycle (_eventSubscription_subscribed parentSub)
305 liftIO $ writeIORef occRef (Just a)
311 liftIO $ writeIORef occRef (Just a)
306 scheduleClear occRef
312 scheduleClear occRef
307 propagateFast a subscribers
313 propagateFast a subscribers
308− , subscriberInvalidateHeight = FastWeakBag.traverse subscribers . invalidateSubscriberHeight
314+ , subscriberInvalidateHeight = FastWeakBag.traverse_ subscribers . invalidateSubscriberHeight
309− , subscriberRecalculateHeight = FastWeakBag.traverse subscribers . recalculateSubscriberHeight
315+ , subscriberRecalculateHeight = FastWeakBag.traverse_ subscribers . recalculateSubscriberHeight
311−||||||| merged common ancestors
312− (parentSub, occ) <- subscribeAndRead e $ Subscriber
313− { subscriberPropagate = \a -> do
314− liftIO $ writeIORef occRef $ Just a
315− scheduleClear occRef
316− propagateFast a subscribers
317− , subscriberInvalidateHeight = \old -> do
318− FastWeakBag.traverse subscribers $ invalidateSubscriberHeight old
319− , subscriberRecalculateHeight = \new -> do
320− FastWeakBag.traverse subscribers $ recalculateSubscriberHeight new
323− (parentSub, occ) <- subscribeAndRead e $ Subscriber
324− { subscriberPropagate = \a -> do
325− liftIO $ writeIORef occRef $ Just a
326− scheduleClear occRef
327− propagateFast a subscribers
328− , subscriberInvalidateHeight = \old -> do
329− FastWeakBag.traverse_ subscribers $ invalidateSubscriberHeight old
330− , subscriberRecalculateHeight = \new -> do
331− FastWeakBag.traverse_ subscribers $ recalculateSubscriberHeight new
334 when (isJust occ) $ do
317 when (isJust occ) $ do
335 liftIO $ writeIORef occRef occ -- Set the initial value of occRef; we don't need to do this if occ is Nothing
318 liftIO $ writeIORef occRef occ -- Set the initial value of occRef; we don't need to do this if occ is Nothing
336 scheduleClear occRef
319 scheduleClear occRef