summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Page.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-24 11:31:36 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-24 11:31:36 +0100
commit4295de01bc524b5dccb17dfe2e50f2121feeea07 (patch)
tree1faffd2eeae3b907bfd130bb765368d8eb181b42 /src/Text/Hakyll/Page.hs
parent59e3c7f277a64f09ef65c4ca42d7c2398f04acd4 (diff)
downloadhakyll-4295de01bc524b5dccb17dfe2e50f2121feeea07.tar.gz
Added tagMap caching.
Because the readTagMap function was currently one of the bottlenexks, this has caused a speedup of 900% for some test cases, so yay for that.
Diffstat (limited to 'src/Text/Hakyll/Page.hs')
-rw-r--r--src/Text/Hakyll/Page.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Hakyll/Page.hs b/src/Text/Hakyll/Page.hs
index abfd0b8..b9507b6 100644
--- a/src/Text/Hakyll/Page.hs
+++ b/src/Text/Hakyll/Page.hs
@@ -120,7 +120,7 @@ readPageFromFile path = do
-- Read file.
contents <- liftIO $ readFile path
- let sections = splitAtDelimiters $ lines $ contents
+ let sections = splitAtDelimiters $ lines contents
context = concat $ zipWith ($) sectionFunctions sections
page = fromContext $ M.fromList $
[ ("url", url)
@@ -135,11 +135,11 @@ readPageFromFile path = do
-- read it from the file given and store it in the cache.
readPage :: FilePath -> Hakyll Page
readPage path = do
- cacheResult <- getFromCache path
- case cacheResult of (Just page) -> return page
- Nothing -> do page <- readPageFromFile path
- storeInCache page path
- return page
+ isCacheMoreRecent' <- isCacheMoreRecent path [path]
+ if isCacheMoreRecent' then getFromCache path
+ else do page <- readPageFromFile path
+ storeInCache page path
+ return page
-- Make pages renderable.
instance Renderable Page where