1
1
mirror of https://github.com/anoma/juvix.git synced 2024-08-17 04:01:05 +03:00
juvix/test
Jan Mas Rovira 6fcc9f21d2
Improve performance of formatting a project (#2863)
Currently formatting a project is equivalent to running `juvix format`
on each individual file. Hence, the performance is quadratic wrt the
number of modules in the project. This pr fixes that and we now we only
process each module once.

# Benchmark (1236% faster 🚀)
Checking the standard library
```
hyperfine --warmup 1 'juvix format --check' 'juvix-main format --check'
Benchmark 1: juvix format --check
  Time (mean ± σ):     450.6 ms ±  33.7 ms    [User: 707.2 ms, System: 178.7 ms]
  Range (min … max):   396.0 ms … 497.0 ms    10 runs

Benchmark 2: juvix-main format --check
  Time (mean ± σ):      6.019 s ±  0.267 s    [User: 9.333 s, System: 1.512 s]
  Range (min … max):    5.598 s …  6.524 s    10 runs

Summary
  juvix format --check ran
   13.36 ± 1.16 times faster than juvix-main format --check
```

# Other changes:
1. The `EntryPoint` field `entryPointModulePath` is now optional.
2. I've introduced a new type `TopModulePathKey` which is analogous to
`TopModulePath` but wihout location information. It is used in hashmap
keys where the location in the key is never used. This is useful as we
can now get a `TopModulePathKey` from a `Path Rel File`.
3. I've refactored the `_formatInput` field in `FormatOptions` so that
it doesn't need to be a special case anymore.
4. I've introduced a new effect `Forcing` that allows to individually
force fields of a record type with a convenient syntax.
5. I've refactored some of the constraints in scoping so that they only
require `Reader Package` instead of `Reader EntryPoint`.
6. I've introduced a new type family so that local modules are no longer
required to have `ModuleId` from their type. Before, they were assigned
one, but it was never used.


# Future work:
1. For project-wise formatting, the compilation is done in parallel, but
the formatting is still done sequentially. That should be improved.
2024-07-01 18:05:24 +02:00
..
Anoma Support Anoma representation of Maybe (#2856) 2024-06-26 12:39:36 +01:00
Asm Refactor pipeline functions for tests (#2864) 2024-06-28 12:15:51 +02:00
BackendGeb Use prettyString instead of show . pretty (#2711) 2024-04-12 10:26:54 +02:00
BackendMarkdown Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
Casm Refactor pipeline functions for tests (#2864) 2024-06-28 12:15:51 +02:00
Compilation Refactor pipeline functions for tests (#2864) 2024-06-28 12:15:51 +02:00
Core Refactor pipeline functions for tests (#2864) 2024-06-28 12:15:51 +02:00
Examples Run test suite in parallel (#2507) 2023-11-16 16:19:52 +01:00
Formatter Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
Internal Bugfix: modules associated with inductive types should be declared after their inductive types (#2768) 2024-05-14 19:32:22 +02:00
Nockma Refactor pipeline functions for tests (#2864) 2024-06-28 12:15:51 +02:00
Package Parallel pipeline (#2779) 2024-05-31 12:41:30 +01:00
Parsing Fix typos (#2573) 2024-01-08 13:27:18 +01:00
Reg Dead code elimination in JuvixReg (#2835) 2024-06-24 13:56:50 +02:00
Repl Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
Resolver Fix typos (#2573) 2024-01-08 13:27:18 +01:00
Runtime Rust backend (#2787) 2024-05-29 13:34:04 +02:00
Rust RISC0 Rust backend (#2792) 2024-06-07 07:57:27 +02:00
Scope Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
Termination Fix typos (#2573) 2024-01-08 13:27:18 +01:00
Tree Add GHC Identity to Juvix/Prelude (#2815) 2024-06-07 18:40:42 +02:00
Typecheck Fixes crash when trying to normalize case expression (#2811) 2024-06-07 15:43:50 +02:00
VampIR Refactor pipeline functions for tests (#2864) 2024-06-28 12:15:51 +02:00
Anoma.hs Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
Asm.hs Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
BackendGeb.hs End-to-end Geb compilation tests (#1942) 2023-03-29 14:02:40 +02:00
BackendMarkdown.hs Add MarkdownInfo entry in Module Concrete Decl and proper errors (#2515) 2023-11-16 11:20:34 +01:00
Base.hs RISC0 Rust backend (#2792) 2024-06-07 07:57:27 +02:00
Casm.hs JuvixReg to CASM translation (#2671) 2024-03-20 12:14:12 +01:00
Compilation.hs Remove old typechecker (#2545) 2023-12-01 16:50:37 +01:00
Core.hs Implement core transformation let-hoisting (#2076) 2023-05-16 13:42:44 +02:00
Examples.hs Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Format.hs Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
Formatter.hs Add juvix format command (#1886) 2023-03-29 15:51:04 +02:00
Internal.hs Add translation from Internal to Core (#1567) 2022-11-07 14:47:56 +01:00
Main.hs RISC0 Rust backend (#2792) 2024-06-07 07:57:27 +02:00
Nockma.hs Nockma compile (#2570) 2024-01-17 11:15:38 +01:00
Package.hs Use JuvixError instead of Text for errors in Package file loading (#2459) 2023-10-23 19:01:36 +01:00
Parsing.hs Disallow tab characters as spaces (#1523) 2022-09-07 13:59:41 +02:00
Reg.hs JuvixReg recursors (#2641) 2024-02-19 08:58:19 +00:00
Repl.hs Update REPL artifacts with builtins from stored modules (#2639) 2024-02-26 16:19:04 +00:00
Resolver.hs Per-module compilation (#2468) 2023-12-30 20:15:35 +01:00
Runtime.hs Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
Rust.hs RISC0 Rust backend (#2792) 2024-06-07 07:57:27 +02:00
Scope.hs [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Termination.hs Add the termination checker to the pipeline (#111) 2022-05-30 13:40:52 +02:00
Tree.hs JuvixTree recursors and transformation framework (#2594) 2024-01-29 16:43:08 +00:00
Typecheck.hs Remove old typechecker (#2545) 2023-12-01 16:50:37 +01:00
VampIR.hs Check valid argument names in YAML (#2193) 2023-06-15 16:42:58 +02:00