diff options
author | pacien | 2020-06-15 04:46:11 +0200 |
---|---|---|
committer | pacien | 2020-06-16 18:34:32 +0200 |
commit | 52abb806a3bde6eb69d64564d971efae2cbfda24 (patch) | |
tree | 3649f42ab8bccc348a68e67fbec97f6b4868ef5d /compiler/src/Input.hs | |
parent | 8905383e2d17e2adb4097e1ce2e7f90ab9ceb5f5 (diff) | |
download | ldgallery-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.hs | 4 |
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) | |||
28 | import Control.Monad.IO.Class (MonadIO, liftIO) | 28 | import Control.Monad.IO.Class (MonadIO, liftIO) |
29 | import Data.Function ((&)) | 29 | import Data.Function ((&)) |
30 | import Data.Functor ((<&>)) | 30 | import Data.Functor ((<&>)) |
31 | import Data.Maybe (catMaybes) | 31 | import Data.Maybe (catMaybes, fromMaybe) |
32 | import Data.Bool (bool) | 32 | import Data.Bool (bool) |
33 | import Data.List (find) | 33 | import Data.List (find) |
34 | import Data.Time.Clock (UTCTime) | 34 | import Data.Time.Clock (UTCTime) |
@@ -91,7 +91,7 @@ readSidecarFile :: FilePath -> IO Sidecar | |||
91 | readSidecarFile filepath = | 91 | readSidecarFile 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 | ||
97 | readInputTree :: AnchoredFSNode -> IO InputTree | 97 | readInputTree :: AnchoredFSNode -> IO InputTree |