Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split syntax module to reduce compilation time (#1852)
Hello, Splitting `Swarm.Language.Syntax` into submodules reduces the compilation time quite a bit. Currently, it takes the most of time out of all the modules. Here's a chart: ![CleanShot 2024-05-17 at 17 09 38@2x](https://github.com/swarm-game/swarm/assets/15181803/fc2672ea-4032-4140-93e7-16d9d4aaea69) That's ~20s for simplifier (with overall compilation time of 4.3 mins) Just taking out the types and functions related to `Constants` and putting them in a separate module results in: ![CleanShot 2024-05-17 at 17 11 45@2x](https://github.com/swarm-game/swarm/assets/15181803/ac4c57e9-af46-4861-b305-8540c1b01bab) Thats ~8.5 seconds for simplifier (with overall compilation time of 3.9 mins) Just for added info, timings taken on a 2019 macbook with i7 processor (6 core and 32 GB RAM) Changes include: - `Swarm.Language.Syntax` split into the following modules: - `Swarm.Language.Syntax.Comments` - Types for working with comments. - `Swarm.Language.Syntax.Type` - Core types (`Syntax'`, `Term'` and `DelayType`) - `Swarm.Language.Syntax.Pattern` - Pattern synonyms for untyped terms - `Swarm.Language.Syntax.Loc` - Types for working with location in source code (`SrcLoc` and related types) - `Swarm.Language.Syntax.Util` - Helper functions (Eg: `mkTuple`, `freeVarsS` etc) Compilation chart after the split: ![CleanShot 2024-05-18 at 15 20 17@2x](https://github.com/swarm-game/swarm/assets/15181803/b6a138dd-c0a3-416f-a620-2d82cb418c7d) `Swarm.Language.Syntax` is no longer the most time taking module. Closes #1844
- Loading branch information