Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split compiler/src/Utils.elm into multiple modules #10

Open
decioferreira opened this issue Sep 10, 2024 · 0 comments
Open

split compiler/src/Utils.elm into multiple modules #10

decioferreira opened this issue Sep 10, 2024 · 0 comments
Milestone

Comments

@decioferreira
Copy link

Currently, most of the utils functions are in compiler/src/Utils.elm. We should review this and split this into compiler/src/Utils/Main.elm as the main entry, and create other files like:

  • compiler/src/Utils/Crash.elm - specifically for the crash function
  • other files relative to each sub-section that currently exists in compiler/src/Utils.elm (eg. functions starting with map..., dir..., fp..., etc.)
@decioferreira decioferreira added this to the v1.0 milestone Sep 10, 2024
decioferreira added a commit that referenced this issue Dec 8, 2024
The main change here revolved around the re-implementation of the IO
monad, allowing for the removal of the need for the top level decoder.

As part of this work we had to move some of the data structures from
modules like `Compiler.Type.UnionFind`, `Compiler.Type.Type` and
`Compiler.Elm.ModuleName` into the IO monad modules, so that we can have
them directly referred on the `RealWorld` record (before we had to use
`Decode.Value` because otherwise we would create import cycles).

This also:
- seems to have solved #33
- partially addresses #10
- greatly improved performance (relates to #37)

The improvement on performance was the following (from `~56:58.46` to
`~2:28.32`):

Before:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm 
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/json 1.1.3
  ● pilatch/flip 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/regex 1.0.0
  ● elm/random 1.0.0
  ● elm/bytes 1.0.8
  ● fredcy/elm-parseint 2.0.1
  ● dasch/levenshtein 1.0.3
  ● rtfeldman/elm-hex 1.0.0
  ● elm/parser 1.1.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● elm-community/basics-extra 4.1.0
  ● elm/url 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/list-extra 8.7.0
  ● elm-community/maybe-extra 5.3.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm/core 1.0.5
  ● zwilias/elm-rosetree 1.5.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● elm/html 1.0.0
  ● elm-explorations/test 2.2.0

Dependencies ready!           
Success! Compiled 132 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  3666.89s user 249.74s system 114% cpu 56:58.46 total
```

After:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/bytes 1.0.8
  ● elm/regex 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/random 1.0.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● rtfeldman/elm-hex 1.0.0
  ● fredcy/elm-parseint 2.0.1
  ● elm/html 1.0.0
  ● elm/json 1.1.3
  ● dasch/levenshtein 1.0.3
  ● elm-community/list-extra 8.7.0
  ● elm/url 1.0.0
  ● elm/core 1.0.5
  ● pilatch/flip 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/basics-extra 4.1.0
  ● elm-community/maybe-extra 5.3.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● zwilias/elm-rosetree 1.5.0
  ● elm/parser 1.1.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm-explorations/test 2.2.0

Dependencies ready!           
Success! Compiled 141 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  157.99s user 2.57s system 108% cpu 2:28.32 total
```
decioferreira added a commit that referenced this issue Dec 8, 2024
The main change here revolved around the re-implementation of the IO
monad, allowing for the removal of the need for the top level decoder.

As part of this work we had to move some of the data structures from
modules like `Compiler.Type.UnionFind`, `Compiler.Type.Type` and
`Compiler.Elm.ModuleName` into the IO monad modules, so that we can have
them directly referred on the `RealWorld` record (before we had to use
`Decode.Value` because otherwise we would create import cycles).

This also:
- seems to have solved #33
- partially addresses #10
- greatly improved performance (relates to #37)

The improvement on performance was the following (from `~56:58.46` to
`~2:28.32`):

Before:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/json 1.1.3
  ● pilatch/flip 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/regex 1.0.0
  ● elm/random 1.0.0
  ● elm/bytes 1.0.8
  ● fredcy/elm-parseint 2.0.1
  ● dasch/levenshtein 1.0.3
  ● rtfeldman/elm-hex 1.0.0
  ● elm/parser 1.1.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● elm-community/basics-extra 4.1.0
  ● elm/url 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/list-extra 8.7.0
  ● elm-community/maybe-extra 5.3.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm/core 1.0.5
  ● zwilias/elm-rosetree 1.5.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● elm/html 1.0.0
  ● elm-explorations/test 2.2.0

Dependencies ready!
Success! Compiled 132 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  3666.89s user 249.74s system 114% cpu 56:58.46 total
```

After:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/bytes 1.0.8
  ● elm/regex 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/random 1.0.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● rtfeldman/elm-hex 1.0.0
  ● fredcy/elm-parseint 2.0.1
  ● elm/html 1.0.0
  ● elm/json 1.1.3
  ● dasch/levenshtein 1.0.3
  ● elm-community/list-extra 8.7.0
  ● elm/url 1.0.0
  ● elm/core 1.0.5
  ● pilatch/flip 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/basics-extra 4.1.0
  ● elm-community/maybe-extra 5.3.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● zwilias/elm-rosetree 1.5.0
  ● elm/parser 1.1.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm-explorations/test 2.2.0

Dependencies ready!
Success! Compiled 141 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  157.99s user 2.57s system 108% cpu 2:28.32 total
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant