@@ -64,7 +64,7 @@ import Language.Javascript.JSaddle.Types
6464import Language.Javascript.JSaddle.Exception (JSException(..))
6565-- import Language.Javascript.JSaddle.Native.Internal (wrapJSVal)
6666import Control.DeepSeq (deepseq)
67−import GHC.Stats (getGCStats, GCStats(..))
67+import GHC.Stats (getGCStatsEnabled, getGCStats, GCStats(..))
6868#endif
6969
7070-- | Forces execution of pending asyncronous code
@@ -167,9 +167,11 @@ runJavaScript sendBatch entryPoint = do
167167 Just cb -> void . forkIO $ runReaderT (unJSM $ cb f' this' args) ctx
168168 m -> putMVar recvMVar m
169169 logInfo s = do
170− current <- currentBytesUsed <$> getGCStats
171− cbCount <- M.size <$> readTVarIO callbacks
172− putStrLn . s $ show (current, cbCount)
170+ stats <- getGCStatsEnabled
171+ when stats $ do
172+ current <- currentBytesUsed <$> getGCStats
173+ cbCount <- M.size <$> readTVarIO callbacks
174+ putStrLn . s $ show (current, cbCount)
173175 _ <- forkIO . forever $ readBatch commandChan >>= \case
174176 (batch@(Batch cmds _), resultMVars) -> do
175177 logInfo (\x -> "Sync " <> x <> show (length cmds, last cmds))