瀏覽代碼

Some Yesod (attempted) optimizations

Michael Snoyman 11 年之前
父節點
當前提交
ba6da3c014
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      frameworks/Haskell/yesod/bench/src/yesod.hs

+ 8 - 2
frameworks/Haskell/yesod/bench/src/yesod.hs

@@ -64,11 +64,17 @@ mkYesod "App" [parseRoutes|
 
 instance Yesod App where
     makeSessionBackend _ = return Nothing
+    {-# INLINE makeSessionBackend #-}
     shouldLog _ _ _ = False
+    {-# INLINE shouldLog #-}
     yesodMiddleware = id
+    {-# INLINE yesodMiddleware #-}
+    cleanPath _ = Right
+    {-# INLINE cleanPath #-}
 
-getJsonR :: Handler Value
-getJsonR = return $ object ["message" .= ("Hello, World!" :: Text)]
+getJsonR :: Handler TypedContent
+getJsonR = return $ TypedContent typeJson
+         $ toContent $ object ["message" .= ("Hello, World!" :: Text)]
 
 
 getDbR :: Handler Value