-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support sharing ModuleInfoCache between pipeline runs (#2753)
This PR delays running of the pipeline `MCache` (renamed to `ModuleInfoCache`) to allow this cache to be shared between pipeline runs in `processRecursiveUpToTyped`. `processRecursiveUpToTyped` is used by the `juvix html` command to recursively build HTML for modules in a project. * Closes #2744 ## Performance The docs build is now much faster and takes much less memory: Before: ``` $ /usr/bin/time -lh juvix html docs/index.juvix.md 1m17.41s real 35.39s user 11.42s sys 5918703616 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 3665213 page reclaims 697 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 114533 voluntary context switches 81450 involuntary context switches 595152097097 instructions retired 143688878963 cycles elapsed 19323983744 peak memory footprint ``` After: ``` $ /usr/bin/time -lh juvix html docs/index.juvix.md 8.35s real 5.76s user 0.62s sys 2992160768 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 221870 page reclaims 719 page faults 0 swaps 0 block input operations 0 block output operations 0 messages sent 0 messages received 0 signals received 1965 voluntary context switches 1962 involuntary context switches 93909891240 instructions retired 19317129226 cycles elapsed 2963053632 peak memory footprint ``` ## Notes * `MCache` is renamed to `ModuleInfoCache` * `ModuleInfoCache` must be defined in a separate module instead of being defined in `Compiler.Pipeline.Driver` to avoid a cyclic dependency. `ModuleInfoCache` is now used used in `Juvix.Compiler.Pipeline` (in `PipelineEff`) and this module is imported by `Juvix.Compiler.Pipeline.Driver`).
- Loading branch information
1 parent
778b626
commit 844f302
Showing
7 changed files
with
73 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Juvix.Compiler.Pipeline.ImportParents where | ||
|
||
import Juvix.Compiler.Concrete.Data | ||
import Juvix.Prelude.Base | ||
|
||
newtype ImportParents = ImportParents | ||
{ _importParents :: [TopModulePath] | ||
} | ||
deriving newtype (Semigroup, Monoid) | ||
|
||
makeLenses ''ImportParents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Juvix.Compiler.Pipeline.ModuleInfoCache where | ||
|
||
import Juvix.Compiler.Pipeline.EntryPoint | ||
import Juvix.Compiler.Pipeline.Result | ||
import Juvix.Compiler.Store.Language qualified as Store | ||
import Juvix.Data.Effect.Cache | ||
import Juvix.Prelude.Base | ||
|
||
newtype EntryIndex = EntryIndex | ||
{ _entryIxEntry :: EntryPoint | ||
} | ||
|
||
makeLenses ''EntryIndex | ||
|
||
instance Eq EntryIndex where | ||
(==) = (==) `on` (^. entryIxEntry . entryPointModulePath) | ||
|
||
instance Hashable EntryIndex where | ||
hashWithSalt s = hashWithSalt s . (^. entryIxEntry . entryPointModulePath) | ||
|
||
type ModuleInfoCache' a = Cache EntryIndex a | ||
|
||
type ModuleInfoCache = ModuleInfoCache' (PipelineResult Store.ModuleInfo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters