1
1
mirror of https://github.com/anoma/juvix.git synced 2024-07-14 19:30:34 +03:00
Juvix empowers developers to write code in a high-level, functional language, compile it to gas-efficient output VM instructions, and formally verify the safety of their contracts prior to deployment and execution.
Go to file
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
.devcontainer Upgrade to ghc-9.8.2 (#2794) 2024-06-08 14:43:33 +02:00
.github Cairo: untagged record representation (#2853) 2024-06-25 10:29:39 +02:00
app Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
assets Fix typos (#2573) 2024-01-08 13:27:18 +01:00
bench Fix benchmark runtime variant (#2740) 2024-04-22 11:09:27 +01:00
bench2 Add support for anoma-decode builtin (#2775) 2024-05-15 18:30:17 +01:00
examples Update juvix-stdlib to remove non-ASCII indentifiers (#2857) 2024-06-26 10:23:35 +02:00
gnuplot Automatized benchmarks (#1673) 2023-01-05 17:48:26 +01:00
include Make Maybe a builtin inductive type (#2860) 2024-06-26 17:12:29 +01:00
juvix-stdlib@00f6f503db Update juvix-stdlib to remove non-ASCII indentifiers (#2857) 2024-06-26 10:23:35 +02:00
licenses Remove unused files (#2398) 2023-09-28 14:20:19 +02:00
runtime Peephole optimization of Cairo assembly (#2858) 2024-06-27 12:41:27 +02:00
scripts Support for Cairo builtins (#2718) 2024-04-16 19:01:30 +02:00
src Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
test Improve performance of formatting a project (#2863) 2024-07-01 18:05:24 +02:00
tests Peephole optimization of Cairo assembly (#2858) 2024-06-27 12:41:27 +02:00
.clang-format Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
.github_changelog_generator Update Changelog v0.2.3 🎉 2022-08-15 12:24:42 +02:00
.gitignore Rust runtime (#2782) 2024-05-22 12:26:51 +02:00
.gitmodules Rename MiniJuvix to Juvix (#259) 2022-07-08 13:59:45 +02:00
.hlint.yaml Add default arguments (#2408) 2023-10-10 23:28:06 +02:00
.pre-commit-config.yaml Add an if instruction to JuvixReg (#2855) 2024-06-26 19:08:33 +02:00
cabal.hie.yaml Automatized benchmarks (#1673) 2023-01-05 17:48:26 +01:00
cabal.project Upgrade to ghc-9.8.2 (#2794) 2024-06-08 14:43:33 +02:00
cabal.project.freeze Upgrade to ghc-9.8.2 (#2794) 2024-06-08 14:43:33 +02:00
CHANGELOG.md Update CHANGELOG for 0.6.2 (#2824) 2024-06-12 16:26:02 +01:00
cntlines.sh Cairo: Support complex data types in program input (#2822) 2024-06-13 12:37:01 +02:00
CONTRIBUTING.md Fix baseUrl for juvix docs in Doctor command (#2122) 2023-05-24 12:14:30 +02:00
justfile just format uses ghc flags in juvix.cabal (#2844) 2024-06-20 11:30:04 +02:00
LICENSE.md Add new README and md files (#1904) 2023-03-21 20:01:48 +01:00
Makefile Rust runtime (#2782) 2024-05-22 12:26:51 +02:00
package.yaml Upgrade to ghc-9.8.2 (#2794) 2024-06-08 14:43:33 +02:00
README.md Fix tara url svg (#2406) 2023-09-28 19:05:05 +02:00
stack.hie.yaml Refactor hie.yaml and add entry in the readme (#1672) 2022-12-20 16:45:48 +01:00
stack.yaml Upgrade to ghc-9.8.2 (#2794) 2024-06-08 14:43:33 +02:00

Juvix

Tara the Juvix mascot

CI Status

The Juvix compiler CI

Nightly build, release and benchmark

Codebase
Open the Juvix Standard Lib in Github Codespace

This repository is specifically dedicated to the compiler of the Juvix programming language.

For any Juvix-related inquiries, we strongly advise visiting the following resources.

Our documentation offers an in-depth understanding of the Juvix programming language. It encompasses a language reference, examples, blog posts, and numerous other resources to facilitate effective use of Juvix.