aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/Input.hs
diff options
context:
space:
mode:
authorpacien2020-06-15 04:46:11 +0200
committerpacien2020-06-16 18:34:32 +0200
commit52abb806a3bde6eb69d64564d971efae2cbfda24 (patch)
tree3649f42ab8bccc348a68e67fbec97f6b4868ef5d /compiler/src/Input.hs
parent8905383e2d17e2adb4097e1ce2e7f90ab9ceb5f5 (diff)
downloadldgallery-52abb806a3bde6eb69d64564d971efae2cbfda24.tar.gz
compiler: reuse derived item properties from last compilation
A benchmark on an already bulit gallery with ~600 pictures shows a ~90% speedup: Before: Time (mean ± σ): 2.879 s ± 0.125 s [User: 14.686 s, System: 5.511 s] Range (min … max): 2.774 s … 3.203 s 10 runs After: Time (mean ± σ): 289.5 ms ± 15.1 ms [User: 596.1 ms, System: 359.3 ms] Range (min … max): 272.8 ms … 323.0 ms 10 runs GitHub: closes #97
Diffstat (limited to 'compiler/src/Input.hs')
-rw-r--r--compiler/src/Input.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/src/Input.hs b/compiler/src/Input.hs
index 1316cdd..2480f5b 100644
--- a/compiler/src/Input.hs
+++ b/compiler/src/Input.hs
@@ -28,7 +28,7 @@ import Control.Exception (Exception, AssertionFailed(..), throw, throwIO)
28import Control.Monad.IO.Class (MonadIO, liftIO) 28import Control.Monad.IO.Class (MonadIO, liftIO)
29import Data.Function ((&)) 29import Data.Function ((&))
30import Data.Functor ((<&>)) 30import Data.Functor ((<&>))
31import Data.Maybe (catMaybes) 31import Data.Maybe (catMaybes, fromMaybe)
32import Data.Bool (bool) 32import Data.Bool (bool)
33import Data.List (find) 33import Data.List (find)
34import Data.Time.Clock (UTCTime) 34import Data.Time.Clock (UTCTime)
@@ -91,7 +91,7 @@ readSidecarFile :: FilePath -> IO Sidecar
91readSidecarFile filepath = 91readSidecarFile filepath =
92 doesFileExist filepath 92 doesFileExist filepath
93 >>= bool (return Nothing) (decodeYamlFile filepath) 93 >>= bool (return Nothing) (decodeYamlFile filepath)
94 <&> maybe emptySidecar id 94 <&> fromMaybe emptySidecar
95 95
96 96
97readInputTree :: AnchoredFSNode -> IO InputTree 97readInputTree :: AnchoredFSNode -> IO InputTree