diff options
author | pacien | 2019-12-27 15:35:42 +0100 |
---|---|---|
committer | pacien | 2019-12-27 15:35:42 +0100 |
commit | a8cdc6eba4ba496bec816dcb7f3c2c0f5114f4c8 (patch) | |
tree | 4464184f55f400e23d5d6a436696ddaea7f3f7ad /compiler | |
parent | 45df822904cd1759ea4be4bf0c125d8fb6542479 (diff) | |
download | ldgallery-a8cdc6eba4ba496bec816dcb7f3c2c0f5114f4c8.tar.gz |
compiler: enable parallelisation
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/package.yaml | 1 | ||||
-rw-r--r-- | compiler/src/Resource.hs | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/compiler/package.yaml b/compiler/package.yaml index 21677fb..90c4ea5 100644 --- a/compiler/package.yaml +++ b/compiler/package.yaml | |||
@@ -25,6 +25,7 @@ dependencies: | |||
25 | - cmdargs | 25 | - cmdargs |
26 | - JuicyPixels | 26 | - JuicyPixels |
27 | - JuicyPixels-extra | 27 | - JuicyPixels-extra |
28 | - parallel-io | ||
28 | 29 | ||
29 | library: | 30 | library: |
30 | source-dirs: src | 31 | source-dirs: src |
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index a8be913..c3ed959 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs | |||
@@ -32,6 +32,7 @@ module Resource | |||
32 | ) where | 32 | ) where |
33 | 33 | ||
34 | 34 | ||
35 | import Control.Concurrent.ParallelIO.Global (parallel) | ||
35 | import Data.Function ((&)) | 36 | import Data.Function ((&)) |
36 | import Data.List ((\\), subsequences, sortBy) | 37 | import Data.List ((\\), subsequences, sortBy) |
37 | import Data.Ord (comparing) | 38 | import Data.Ord (comparing) |
@@ -76,7 +77,7 @@ buildResourceTree processDir processItem processThumbnail = resNode | |||
76 | do | 77 | do |
77 | processedDir <- processDir path | 78 | processedDir <- processDir path |
78 | processedThumbnail <- maybeThumbnail thumbnailPath | 79 | processedThumbnail <- maybeThumbnail thumbnailPath |
79 | dirItems <- mapM resNode items | 80 | dirItems <- parallel $ map resNode items |
80 | return DirResource | 81 | return DirResource |
81 | { items = dirItems | 82 | { items = dirItems |
82 | , resPath = processedDir | 83 | , resPath = processedDir |